Jp Calderone wrote:
On Tue, 07 Dec 2004 17:46:52 -0800, Heikki Toivonen <heikki@osafoundation.org> wrote:
The most interesting piece of the code is my TLSProtocolWrapper that inherits from ProtocolWrapper. See http://lxr.osafoundation.org/source/internal/m2crypto/M2Crypto/SSL/TwistedPr...
When there is an error in the SSL connection, and I call connectionLost(), I end up with a traceback that feels like it might be a Twisted bug. Or if I am not allowed to call that, how do I signal that I want to break the connection? Here's the traceback:
You should call proto.transport.loseConnection() instead of proto.connectionLost(). The former indicates to the reactor that the connection should be dropped, the latter is a callback that the reactor invokes to tell you that the connection has been dropped.
Ok, that makes the exception go away, but it still does not solve the problem why I tried to use connectionLost() in the first place. I want to signal that this connection was lost because of an error, and calling loseConnection() won't let me specify the error. I am looking at as non-invasive methods as possible, the ultimate goal being that you could hook this up to any existing non-SSL implementation with practically no changes. That seems to rule out custom errbacks. So, when my wrapper notices an SSL error, how do I signal that the connection should be dropped because there was an error - and pass some info about the error along? -- Heikki Toivonen