private void LeaveLobby()
 {
     // cannot leave a started lobby
     Log($"Leaving lobby {joined_lobby.id}");
     joined_lobby.peers.Remove(id);
     if (joined_lobby.peers.Count == 0)
     {
         server.lobbies.Remove(joined_lobby.id);
     }
     else if (joined_lobby.host_id == id)
     {
         Tcp_Session new_host = joined_lobby.peers.Values.First();
         new_host.BecomeHost();
     }
     joined_lobby = null;
 }
 private void MakeHost(Tcp_Session session)
 {
     TransitionState(Tcp_State.PeerWithinLobby);
     session.TransitionState(Tcp_State.HostWithinLobby);
     session.BecomeHost();
 }