@@ -46,6 +46,10 @@ def port(self) -> str:
4646 def num_connections (self ) -> int :
4747 return len (self .currentConnections )
4848
49+ def _log_num_connections (self ):
50+ # lives in its own method so we can overwrite it in children
51+ self .log .info (f'Now { self .num_connections ()} Receiver(s) connected' )
52+
4953 def is_input (self ) -> bool :
5054 return False
5155
@@ -57,8 +61,7 @@ def on_connect(self, sock: socket.socket, *args):
5761 addr [0 ], addr [1 ], conn .fileno ())
5862
5963 self .currentConnections [conn ] = Queue ()
60- self .log .info ('Now %u Receiver(s) connected' ,
61- len (self .currentConnections ))
64+ self ._log_num_connections ()
6265
6366 self .on_accepted (conn , addr )
6467
@@ -68,8 +71,7 @@ def close_connection(self, conn: socket.socket):
6871 if conn in self .currentConnections :
6972 conn .close ()
7073 del (self .currentConnections [conn ])
71- self .log .info ('Now %u Receiver connected' ,
72- len (self .currentConnections ))
74+ self ._log_num_connections ()
7375
7476 @abstractmethod
7577 def on_accepted (self , conn : socket .socket , addr : tuple [str , int ]):
0 commit comments