[Twisted-Python] how to "close" a TLS connection?
Hi.
I'm doing some unit test with TLS but I got:
twisted.trial.util.DirtyReactorError: THIS WILL BECOME AN ERROR SOON!
reactor left in unclean state, the following Selectables were left over:
<
On Wed, 17 May 2006 17:00:29 -0200, Manlio Perillo
Hi.
I'm doing some unit test with TLS but I got:
twisted.trial.util.DirtyReactorError: THIS WILL BECOME AN ERROR SOON! reactor left in unclean state, the following Selectables were left over: <
to ('localhost', 5432) at f0e590> All is ok if I do not use TLS (I simply close the connection).
What's the problem?
TLS close adds a layer of back and forth traffic on top of the existing TCP close handshake. Your test probably assumes that loseConnection() will drop the connection within a certain number of round-trips, but the added TLS negotiation pushes the actual shutdown over that threshhold, so the connection is still around when trial gets around to looking for such things. You should add a Deferred which is fired by the protocol's connectionLost method or the factory's clientConnectionLost method, and make sure your test doesn't end until that Deferred fires. Jean-Paul
participants (2)
-
Jean-Paul Calderone
-
Manlio Perillo