[Twisted-Python] reactor.stop if no any clients

Jonathan Lange jml at mumak.net
Wed Sep 29 13:52:10 EDT 2010

On Wed, Sep 29, 2010 at 6:40 PM, ruslan usifov <ruslan.usifov at 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


More information about the Twisted-Python mailing list