'Hook called by sessionhandler when disconnecting this session.'

def at_disconnect(self):

    if self.logged_in:
        player = self.player
        if self.puppet:
            player.unpuppet_object(self)
        uaccount = player
        uaccount.last_login = timezone.now()
        uaccount.save()
        player.at_disconnect()
        self.logged_in = False
        if (not self.sessionhandler.sessions_from_player(player)):
            player.is_connected = False
        player.at_post_disconnect()
        MONITOR_HANDLER.remove(player, '_saved_webclient_options', self.sessid)
