Commit 7ed7ceb5 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added logging to simple client.

parent 3e96452f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
import ssl
import select
import socket
import logging
from sjrpc.core import RpcConnection, ConnectionManager

class SimpleRpcClient(ConnectionManager):
@@ -82,6 +83,8 @@ class SimpleRpcClient(ConnectionManager):
            try:
                self._connection.receive()
            except socket.error as err:
                logging.error('Socket error while receiving from the client '
                              'fd/%s: %s' % (fd, err))
                self.shutdown()

        if event & select.EPOLLOUT:
@@ -89,9 +92,12 @@ class SimpleRpcClient(ConnectionManager):
            try:
                self._connection.send()
            except socket.error as err:
                logging.error('Socket error while sending to the client '
                              'fd/%s: %s' % (fd, err))
                self.shutdown()

        if event & select.EPOLLHUP:
            logging.error('Socket HUP fd/%s: %s' % (fd, err))
            self.shutdown()                                                      #TODO

    def all_connections(self):