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?