Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyrasite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
pyrasite
Commits
2f5c59ac
Commit
2f5c59ac
authored
Mar 12, 2012
by
Luke Macken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8
parent
25ccafbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
pyrasite/ipc.py
pyrasite/ipc.py
+4
-3
pyrasite/reverse.py
pyrasite/reverse.py
+4
-3
No files found.
pyrasite/ipc.py
View file @
2f5c59ac
...
...
@@ -74,17 +74,18 @@ class PyrasiteIPC(object):
def
listen
(
self
):
"""Listen on a random port"""
for
res
in
socket
.
getaddrinfo
(
'localhost'
,
None
,
socket
.
AF_UNSPEC
,
socket
.
SOCK_STREAM
,
0
,
0
):
for
res
in
socket
.
getaddrinfo
(
'localhost'
,
None
,
socket
.
AF_UNSPEC
,
socket
.
SOCK_STREAM
,
0
,
0
):
af
,
socktype
,
proto
,
canonname
,
sa
=
res
try
:
self
.
server_sock
=
socket
.
socket
(
af
,
socktype
,
proto
)
except
socket
.
error
,
msg
:
except
socket
.
error
:
self
.
server_sock
=
None
continue
try
:
self
.
server_sock
.
bind
(
sa
)
self
.
server_sock
.
listen
(
1
)
except
socket
.
error
,
msg
:
except
socket
.
error
:
self
.
server_sock
.
close
()
self
.
server_sock
=
None
continue
...
...
pyrasite/reverse.py
View file @
2f5c59ac
...
...
@@ -50,16 +50,17 @@ class ReverseConnection(threading.Thread, PyrasiteIPC):
running
=
True
while
running
:
try
:
for
res
in
socket
.
getaddrinfo
(
self
.
host
,
self
.
port
,
socket
.
AF_UNSPEC
,
socket
.
SOCK_STREAM
):
for
res
in
socket
.
getaddrinfo
(
self
.
host
,
self
.
port
,
socket
.
AF_UNSPEC
,
socket
.
SOCK_STREAM
):
af
,
socktype
,
proto
,
canonname
,
sa
=
res
try
:
self
.
sock
=
socket
.
socket
(
af
,
socktype
,
proto
)
except
socket
.
error
,
msg
:
except
socket
.
error
:
self
.
sock
=
None
continue
try
:
self
.
sock
.
connect
(
sa
)
except
socket
.
error
,
msg
:
except
socket
.
error
:
self
.
sock
.
close
()
self
.
sock
=
None
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment