Commit 40e9e61a authored by Antoine Millet's avatar Antoine Millet
Browse files

Unexpected socket error on read now shutdown the connection

This behavior allow to handle properly the case where an error
(such as a Broken Pipe error) is raised when reading on the socket.
When using SimpleServer class, the socket will be removed from the
connected client list. When using as client, the application is in charge
of re-connection exactly like a desired shutdown. A DEBUG logging message
is emitted by the library when this event is triggered.
parent 0703dc09
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -221,7 +221,10 @@ class RpcConnection(object):
                  in RpcConnection.NONBLOCKING_SSL_ERRORS):
                return
            else:
                raise
                # If any fatal error is triggered, the connection is shutdown:
                self.shutdown()
                self.logger.debug('Unexpected socket error: %s', err)
                return
        # For ssl socket, we need to fetch buffered ssl-side data:
        if isinstance(self._sock, ssl.SSLSocket):
            pending = self._sock.pending()