'Clean up when the connection has been lost.
@type reason: L{Failure}
@param reason: The reason the connection was terminated.'

def connectionLost(self, reason):

    if (self._onLogout is not None):
        self._onLogout()
        self._onLogout = None
    self.setTimeout(None)
