Commit 839a1ed2 authored by Anael Beutot's avatar Anael Beutot Committed by Anaël Beutot
Browse files

Handle accept in a loop and catch more errors on accept

parent ef9aab1f
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -70,11 +70,14 @@ class RpcServer(object):
    def _handle(self, watcher, revents):
        # Collect offline connections:
        self._collect_connection()
        while True:
            try:
                sock, address = self._sock.accept()
            except socket.error as err:
                if err.errno in self.NONBLOCKING_ERRORS:
                    return
                if err.errno in (errno.ECONNABORTED, errno.EPROTO, errno.EINTR):
                    pass
                else:
                    self.logger.warn('Error while accepting client: %s', err)
                    return