[Twisted-Python] FW: reject all open connections
From: iraehc@hotmail.com To: twisted-python@twistedmatrix.com Subject: reject all open connections Date: Sat, 21 Jun 2008 22:26:37 +0200 hi all! i am sorry, its the first time i am asking something twice but its important for me to get a question. thank you!: i just want to clean my reactor - all readers and writer should looseConnection() but how can i do this? reactor.removeAll() dont do it. the best solutions i found was a horrible workaround: a thread is tarted, which constantly calls ``[conn.loseConnection() for conn in reactor.removeAll()]`` is there a better solution? thank you Conheça já o Windows Live Spaces, o site de relacionamentos do Messenger! Crie já o seu! _________________________________________________________________ Conheça o Windows Live Spaces, a rede de relacionamentos do Messenger! http://www.amigosdomessenger.com.br/
On Thu, 26 Jun 2008 23:08:00 +0200, Irae Hueck Costa <iraehc@hotmail.com> wrote:
i just want to clean my reactor - all readers and writer should looseConnection()
but how can i do this? reactor.removeAll() dont do it. the best solutions i found was a horrible workaround: a thread is tarted, which constantly calls ``[conn.loseConnection() for conn in reactor.removeAll()]``
is there a better solution?
This is an unusual thing to want to do. Any code that does it risks stomping on other code it doesn't know about. If you have a factory serving connections on a particular port, you might want to have that factory keep track of all clients which are connected to it, then it can iterate over those clients and disconnect them. If you use removeAll(), then you'll probably end of breaking some reactor internals (like threading support and maybe other stuff). However, if that's your goal, then the list comprehension you pasted is more or less correct. Jean-Paul
participants (2)
-
Irae Hueck Costa -
Jean-Paul Calderone