[Twisted-Python] Problems with TLS connection not shutting down.

Michael Williamson williamson.michaelr at gmail.com
Thu Mar 28 12:24:17 EDT 2013

Hi, I'm having an issue where a tls connection never seems to shutdown
properly, and as a result, all the associated cleanup never happens.

Basically we're trying to implement a jabber client and allow the user to
sign out and then re-sign back in without completely quitting the program.
 When the user tries to sign back in, Twisted goes nuts because the
original connection was never shutdown properly.

So, I traced through the code with the debugger and I came to the
_shutdownTLS() function in tls.py.  I believe that what's supposed to
happen is that the first time through, the self._tlsConnection.shutdown()
returns False because the shutdown is initiated.  Then, when the 2nd part
of the shutdown handshake comes back from the server, dataReceived is
called, which calls shutdownTLS again, and then the cleanup can continue.

The problem is that after the initial call to shutdownTLS, I never see
anymore data from the server.  I'm not sure if it's a server issue (we're
just connecting to the Google jabber servers) where they don't close down
their SSL connections correctly, or if I'm just doing something silly.  So
anyway, I could solve this by overriding a bunch of stuff and ensuring that
self.transport.loseConnection() gets called no matter what, even when the
server doesn't respond with the second part of the close handshake, but I
figured I'd ask here first.

So, any TLS experts out there?  Thanks for any help or information - I
really appreciate it,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20130328/3e05c5e5/attachment.htm 

More information about the Twisted-Python mailing list