[Twisted-Python] Twisted protocol instances : a puzzle

Glyph Lefkowitz glyph at twistedmatrix.com
Sat Oct 16 23:07:34 EDT 2010

On Oct 16, 2010, at 10:02 AM, Marcus.CM wrote:

> How do i find out if a particular connection is already dead in the 
> given "account" class?

There's no way to know; it's a race condition.  If the connection dies before authentication, then requestAvatar won't be called.  If the connection dies shortly afterward, you'll get a connectionLost shortly after authentication, but there's no way to predict that that's about to happen.

If the connection dies at the exact moment that authentication occurs... well, the joke's on you, in a network of Von Neumann architecture computers, there's no such thing as the "exact moment".  It actually died shortly afterwards, just so shortly that it seemed simultaneous to a casual human observer.  So as far as the code's concerned, it's the same as the "shortly afterward" case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20101016/a7bbdb9f/attachment.htm 

More information about the Twisted-Python mailing list