views:

54

answers:

1

I want to disconnect cleanly, and then stop the reactor. If I do this, however:

controller.connection.disconnect()
reactor.stop()

then I get a "connection was lost in a non-clean fashion" message. If I insert a time.sleep(1) in between them, the connection closes cleanly. How can I wait until the connection is really closed?

+3  A: 

You could listen for a callback from twisted which indicates that the connection has been disconnected. This blog describes an approach to do this.

David Underhill
yep worked well once I figured out how it was doing what it did
Claudiu