Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
ce608653
Commit
ce608653
authored
Feb 25, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error handling when setting up a listening connector
getAddress (via __repr__) raised EBADF on closed connectors.
parent
1a070186
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
neo/lib/connector.py
neo/lib/connector.py
+6
-6
No files found.
neo/lib/connector.py
View file @
ce608653
...
@@ -127,6 +127,7 @@ class SocketConnector(object):
...
@@ -127,6 +127,7 @@ class SocketConnector(object):
self
.
_bind
(
self
.
addr
)
self
.
_bind
(
self
.
addr
)
self
.
socket
.
listen
(
self
.
SOMAXCONN
)
self
.
socket
.
listen
(
self
.
SOMAXCONN
)
except
socket
.
error
,
e
:
except
socket
.
error
,
e
:
self
.
is_closed
=
True
self
.
socket
.
close
()
self
.
socket
.
close
()
self
.
_error
(
'listen'
,
e
)
self
.
_error
(
'listen'
,
e
)
...
@@ -220,12 +221,13 @@ class SocketConnector(object):
...
@@ -220,12 +221,13 @@ class SocketConnector(object):
def
__repr__
(
self
):
def
__repr__
(
self
):
if
self
.
is_closed
is
None
:
if
self
.
is_closed
is
None
:
state
=
'never opened'
state
=
'
,
never opened'
else
:
else
:
if
self
.
is_closed
:
if
self
.
is_closed
:
state
=
'closed '
state
=
'
,
closed '
else
:
else
:
state
=
'opened '
state
=
' fileno %s %s, opened '
%
(
self
.
socket_fd
,
self
.
getAddress
())
if
self
.
is_server
is
None
:
if
self
.
is_server
is
None
:
state
+=
'listening'
state
+=
'listening'
else
:
else
:
...
@@ -234,9 +236,7 @@ class SocketConnector(object):
...
@@ -234,9 +236,7 @@ class SocketConnector(object):
else
:
else
:
state
+=
'to '
state
+=
'to '
state
+=
str
(
self
.
addr
)
state
+=
str
(
self
.
addr
)
return
'<%s at 0x%x fileno %s %s, %s>'
%
(
self
.
__class__
.
__name__
,
return
'<%s at 0x%x%s>'
%
(
self
.
__class__
.
__name__
,
id
(
self
),
state
)
id
(
self
),
'?'
if
self
.
is_closed
else
self
.
socket_fd
,
self
.
getAddress
(),
state
)
class
SocketConnectorIPv4
(
SocketConnector
):
class
SocketConnectorIPv4
(
SocketConnector
):
" Wrapper for IPv4 sockets"
" Wrapper for IPv4 sockets"
...
...
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