[Twisted-Python] Twisted protocol instances : a puzzle

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Sun Oct 17 08:28:10 MDT 2010


On 16 Oct, 02:02 pm, marcus at internetnowasp.net wrote:
>Hi,
>
>This might seems like a trivial question or at least i would have
>thought so but it has eluded me for some time on how to do this 
>elegantly.
>In twisted mail, since the only part where we instantiate an instance 
>of
>account  is under :
>
>   def requestAvatar(self, avatarId, mind, *interfaces):
>        account = xxinterface() # instantiate our account
>
>How do i find out if a particular connection is already dead in the
>given "account" class? For smtp for example,
>"mind" is None and avatarId is just the id of the login user. Even if
>this is pop3 or imap, the same problem arise
>how do i know if the connection of the particular "Server" instance is
>dead.

Perhaps you want to do something with the logout callback that 
requestAvatar is also responsible for returning?  The SMTP protocol 
implementation will call it when the connection is lost.

Jean-Paul




More information about the Twisted-Python mailing list