I wish to get a list of connections to a manager. I can get last_accepted from the servers' listener, but I want all connections. There HAS to be a method I am missing somewhere to return all connections to a server or manager Please help!!
A:
Looking at multiprocessing/connection.py
, the listener just doesn't seem to track all connections -- you could, however, subclass it and override accept
to append accepted connections to a list.
Alex Martelli
2010-04-22 03:05:27
Thanks Alex, this is where I was going with this problem. It seems odd that the 'manager' does not keep track of the connections made to it, meaning it cannot really manage them. I thought I had missed something.Thanks again
tranimatronic
2010-04-22 13:20:40
subclassing connection.Listener.accept() is not nearly as easy as it sounds.BaseManager.get_server() returns a server that names connection.Listener in the definition of listener_client - so the subclass of Listener is overridden whenever a Server is returned by get_server().Basically I had to override BaseManager.get_server() to return a changed version of Server using my overridden Listener rather than the one it is receiving from listener_client.It works, but it does seem long way round to be able to return a list of connections to my manager.Alternatives anyone ??
tranimatronic
2010-04-22 20:01:30