diff --git a/src/net/clientthread.h b/src/net/clientthread.h index c50dd6e2..aec2dcc9 100644 --- a/src/net/clientthread.h +++ b/src/net/clientthread.h @@ -103,6 +103,9 @@ protected: void CompleteTempAvatarData(unsigned playerId); void SetUnknownAvatar(unsigned playerId); + void UnsubscribeLobbyMsg(); + void ResubscribeLobbyMsg(); + const ClientContext &GetContext() const; ClientContext &GetContext(); diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index 128d24b5..47bb8669 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -672,6 +672,9 @@ AbstractClientStateReceiving::Process(ClientThread &client) NetPacketRemovedFromGame::Data removedData; tmpPacket->ToNetPacketRemovedFromGame()->GetData(removedData); client.ClearPlayerDataList(); + // Resubscribe Lobby messages. + client.ResubscribeLobbyMsg(); + // Show Lobby. client.GetCallback().SignalNetClientWaitDialog(); client.GetCallback().SignalNetClientRemovedFromGame(removedData.removeReason); client.SetState(ClientStateWaitJoin::Instance()); @@ -1017,8 +1020,7 @@ ClientStateSynchronizeStart::Process(ClientThread &client) boost::shared_ptr startAck(new NetPacketStartEventAck); client.GetSender().Send(client.GetContext().GetSessionData(), startAck); // Unsubscribe lobby messages. - boost::shared_ptr unsubscr(new NetPacketUnsubscribeGameList); - client.GetSender().Send(client.GetContext().GetSessionData(), unsubscr); + client.UnsubscribeLobbyMsg(); client.SetState(ClientStateWaitStart::Instance()); } @@ -1149,11 +1151,8 @@ ClientStateWaitHand::InternalProcess(ClientThread &client, boost::shared_ptrgetMyName(), curGame->getMyGameID()); - // Clear game info map as it is outdated. - client.ClearGameInfoMap(); // Resubscribe Lobby messages. - boost::shared_ptr resubscr(new NetPacketResubscribeGameList); - client.GetSender().Send(client.GetContext().GetSessionData(), resubscr); + client.ResubscribeLobbyMsg(); // Show Lobby dialog. client.GetCallback().SignalNetClientWaitDialog(); client.SetState(ClientStateWaitGame::Instance()); diff --git a/src/net/common/clientthread.cpp b/src/net/common/clientthread.cpp index f62fc298..9ba198f7 100644 --- a/src/net/common/clientthread.cpp +++ b/src/net/common/clientthread.cpp @@ -588,6 +588,24 @@ ClientThread::SetUnknownAvatar(unsigned playerId) LOG_ERROR("Server reported unknown avatar for player: " << playerId); } +void +ClientThread::UnsubscribeLobbyMsg() +{ + // Send unsubscribe request. + boost::shared_ptr unsubscr(new NetPacketUnsubscribeGameList); + GetSender().Send(GetContext().GetSessionData(), unsubscr); +} + +void +ClientThread::ResubscribeLobbyMsg() +{ + // Clear game info map as it is outdated. + ClearGameInfoMap(); + // Send resubscribe request. + boost::shared_ptr resubscr(new NetPacketResubscribeGameList); + GetSender().Send(GetContext().GetSessionData(), resubscr); +} + const ClientContext & ClientThread::GetContext() const { diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 6391d563..eeca6e90 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -855,7 +855,7 @@ ServerLobbyThread::ResubscribeLobbyMsgLoop() SessionWrapper tmpSession = m_gameSessionManager.GetSessionById(*i); if (!tmpSession.sessionData.get()) tmpSession = m_sessionManager.GetSessionById(*i); - if (tmpSession.sessionData.get()); + if (tmpSession.sessionData.get()) InternalResubscribeMsg(tmpSession); ++i; }