Skip to content
Permalink
Browse files

Improove error handling during TLS handshake

if client already disconnected immediately.

Traceback (most recent call last):
  File "/home/spaceone/git/circuits/circuits/core/manager.py", line 834, in processTask
    value = next(task)
  File "/home/spaceone/git/circuits/circuits/net/sockets.py", line 614, in _accept
    self._on_accept_done(newsock)
  File "/home/spaceone/git/circuits/circuits/net/sockets.py", line 636, in _on_accept_done
    self.fire(connect(sock, *sock.getpeername()))
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 107] Transport endpoint is not connected
  • Loading branch information...
spaceone committed Jan 24, 2019
1 parent 7fea2d0 commit f6ffc705974a6db66e1603f9c8b8270e58bbb4f9
Showing with 8 additions and 1 deletion.
  1. +8 −1 circuits/net/sockets.py
@@ -633,7 +633,14 @@ def _on_accept_done(self, sock, fire_connect_event=True):
self._poller.addReader(self, sock)
self._clients.append(sock)
if fire_connect_event:
self.fire(connect(sock, *sock.getpeername()))
try:
self.fire(connect(sock, *sock.getpeername()))
except SocketError as exc:
if exc.args[0] in (ENOTCONN,):
# the client already disconnected
self._close(sock)
return
raise

def _on_handshake_error(self, sock, err):
self.fire(error(sock, err))

0 comments on commit f6ffc70

Please sign in to comment.
You can’t perform that action at this time.