diff options
-rw-r--r-- | src/net/ea/network.cpp | 3 | ||||
-rw-r--r-- | src/net/ea/network.h | 4 | ||||
-rw-r--r-- | src/net/eathena/network.cpp | 3 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 6 |
4 files changed, 15 insertions, 1 deletions
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index c9360e9c9..c080e35ec 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -65,7 +65,8 @@ Network::Network() : mWorkerThread(nullptr), mMutexIn(SDL_CreateMutex()), mMutexOut(SDL_CreateMutex()), - mSleep(config.getIntValue("networksleep")) + mSleep(config.getIntValue("networksleep")), + mPauseDispatch(false) { TcpNet::init(); } diff --git a/src/net/ea/network.h b/src/net/ea/network.h index 84a4b0635..d9847d55d 100644 --- a/src/net/ea/network.h +++ b/src/net/ea/network.h @@ -67,6 +67,9 @@ class Network notfinal void fixSendBuffer(); + void pauseDispatch() + { mPauseDispatch = true; } + // ERROR replaced by NET_ERROR because already defined in Windows enum { @@ -106,6 +109,7 @@ class Network notfinal SDL_mutex *mMutexIn; SDL_mutex *mMutexOut; int mSleep; + bool mPauseDispatch; }; } // namespace Ea diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index fe13b2f86..2b716c2f8 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -92,6 +92,7 @@ void Network::clearHandlers() void Network::dispatchMessages() { + mPauseDispatch = false; while (messageReady()) { SDL_mutexP(mMutexIn); @@ -132,6 +133,8 @@ void Network::dispatchMessages() } skip(len); + if (mPauseDispatch) + break; } } diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 5338a6f5b..fa7565e46 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -93,6 +93,7 @@ void Network::clearHandlers() void Network::dispatchMessages() { BLOCK_START("Network::dispatchMessages 1") + mPauseDispatch = false; while (messageReady()) { SDL_mutexP(mMutexIn); @@ -133,6 +134,11 @@ void Network::dispatchMessages() } skip(len); + if (mPauseDispatch) + { + BLOCK_END("Network::dispatchMessages 3") + break; + } BLOCK_END("Network::dispatchMessages 3") } BLOCK_END("Network::dispatchMessages 1") |