From bb65ba927ebff80c348fa1f7c3d26de9c8392154 Mon Sep 17 00:00:00 2001 From: Benau Date: Mon, 13 May 2019 14:02:04 +0800 Subject: [PATCH] Always discard unknown synchronous message instead of keeping it Synchronous message can only be EVENT_TYPE_MESSAGE anyway --- src/network/protocols/client_lobby.cpp | 8 +++----- src/network/protocols/server_lobby.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/network/protocols/client_lobby.cpp b/src/network/protocols/client_lobby.cpp index ece2c7c6a..9c964f071 100644 --- a/src/network/protocols/client_lobby.cpp +++ b/src/network/protocols/client_lobby.cpp @@ -147,6 +147,8 @@ void ClientLobby::doneWithResults() bool ClientLobby::notifyEvent(Event* event) { assert(m_game_setup); // assert that the setup exists + if (event->getType() != EVENT_TYPE_MESSAGE) + return true; NetworkString &data = event->data(); assert(data.size()); // assert that data isn't empty @@ -174,7 +176,6 @@ bool ClientLobby::notifyEvent(Event* event) case LE_START_RACE: startGame(event); break; case LE_REPORT_PLAYER: reportSuccess(event); break; default: - return false; break; } // switch return true; @@ -196,8 +197,6 @@ bool ClientLobby::notifyEventAsynchronous(Event* event) { default: break; } // switch - - return true; } // message else if (event->getType() == EVENT_TYPE_DISCONNECTED) { @@ -211,9 +210,8 @@ bool ClientLobby::notifyEventAsynchronous(Event* event) STKHost::get()->setErrorMessage( m_disconnected_msg.at(event->getPeerDisconnectInfo())); STKHost::get()->requestShutdown(); - return true; } // disconnection - return false; + return true; } // notifyEventAsynchronous //----------------------------------------------------------------------------- diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp index d371d7b7f..2d0600d43 100644 --- a/src/network/protocols/server_lobby.cpp +++ b/src/network/protocols/server_lobby.cpp @@ -563,7 +563,7 @@ bool ServerLobby::notifyEvent(Event* event) { assert(m_game_setup); // assert that the setup exists if (event->getType() != EVENT_TYPE_MESSAGE) - return false; + return true; NetworkString &data = event->data(); assert(data.size()); // message not empty