[Twisted-Python] M2Crypto+Twisted, part 2

Heikki Toivonen heikki at osafoundation.org
Wed Dec 8 14:45:38 EST 2004

Jp Calderone wrote:
> On Tue, 07 Dec 2004 17:46:52 -0800, Heikki Toivonen <heikki at osafoundation.org> wrote:
>>The most interesting piece of the code is my TLSProtocolWrapper that 
>>inherits from ProtocolWrapper. See 
>>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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20041208/c156f6e5/attachment.pgp 

More information about the Twisted-Python mailing list