#NEWLINE# def connectionLost( self , reason ) : #NEWLINE# #INDENT# '\n        When the underlying connection is closed, stop the running service (if\n        any), and log out the avatar (if any).\n\n        @type reason: L{twisted.python.failure.Failure}\n        @param reason: The cause of the connection being closed.\n        ' #NEWLINE# if self . service : #NEWLINE# #INDENT# self . service . serviceStopped ( ) #NEWLINE# #UNINDENT# if hasattr ( self , 'avatar' ) : #NEWLINE# #INDENT# self . logoutFunction ( ) #NEWLINE# #UNINDENT# log . msg ( 'connection lost' )