Commit 85285970 authored by Antoine Millet's avatar Antoine Millet
Browse files

Fixed logging in server.

parent b75d3586
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -64,10 +64,12 @@ class SimpleRpcServer(ConnectionManager):
                try:
                try:
                    connection.receive()
                    connection.receive()
                except socket.error as err:
                except socket.error as err:
                    logging.error('Socket error while receiving from client '
                                  'fd/%s: %s' % (fd, err))
                    connection.shutdown(self._on_disconnect)
                    connection.shutdown(self._on_disconnect)
                    del self._clients[fd]
                    del self._clients[fd]
                except Exception as err:
                except Exception as err:
                    logging.error('Unknown error while receiving from client'
                    logging.error('Unknown error while receiving from client '
                                  'fd/%s: %s' % (fd, err))
                                  'fd/%s: %s' % (fd, err))
                    connection.shutdown(self._on_disconnect)
                    connection.shutdown(self._on_disconnect)
                    del self._clients[fd]
                    del self._clients[fd]
@@ -77,15 +79,18 @@ class SimpleRpcServer(ConnectionManager):
                try:
                try:
                    connection.send()
                    connection.send()
                except socket.error as err:
                except socket.error as err:
                    logging.error('Socket error while sending to the client '
                                  'fd/%s: %s' % (fd, err))
                    connection.shutdown(self._on_disconnect)
                    connection.shutdown(self._on_disconnect)
                    del self._clients[fd]
                    del self._clients[fd]
                except Exception as err:
                except Exception as err:
                    logging.error('Unknown error while sending to the client'
                    logging.error('Unknown error while sending to the client '
                                  'fd/%s: %s' % (fd, err))
                                  'fd/%s: %s' % (fd, err))
                    connection.shutdown(self._on_disconnect)
                    connection.shutdown(self._on_disconnect)
                    del self._clients[fd]
                    del self._clients[fd]


            if event & select.EPOLLHUP:
            if event & select.EPOLLHUP:
                logging.error('Socket HUP fd/%s: %s' % (fd, err))
                connection.shutdown(self._on_disconnect)
                connection.shutdown(self._on_disconnect)
                del self._clients[fd]
                del self._clients[fd]