[Twisted-Python] reactor.stop if no any clients
Sept. 29, 2010
5:40 p.m.
If we stop listening, how can i wait while all client connection (which was accepted before stopListening) processed and then call reactor.stop?
September 2010
5:52 p.m.
On Wed, Sep 29, 2010 at 6:40 PM, ruslan usifov <ruslan.usifov@gmail.com> wrote:
If we stop listening, how can i wait while all client connection (which was accepted before stopListening) processed and then call reactor.stop?
In your factory, keep a count of the number of clients you have and whether stopListening has been called. In your protocol's connectionLost() method, decrease that count by one and check to see if it's zero. If it's zero, and stopListening has been called, call reactor.stop(). jml
5230
Age (days ago)
5230
Last active (days ago)
1 comments
2 participants
participants (2)
-
Jonathan Lange
-
ruslan usifov