diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/eathena/network.cpp | 10 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index 17514d025..e7e15d8e4 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -112,7 +112,8 @@ short packet_lengths[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -const unsigned int BUFFER_SIZE = 655360; +const unsigned int BUFFER_SIZE = 1000000; +const unsigned int BUFFER_LIMIT = 930000; int networkThread(void *data) { @@ -443,6 +444,13 @@ void Network::receive() case 1: // Receive data from the socket SDL_mutexP(mMutex); + if (mInSize > BUFFER_LIMIT) + { + SDL_mutexV(mMutex); + SDL_Delay(100); + continue; + } + ret = SDLNet_TCP_Recv(mSocket, mInBuffer + mInSize, BUFFER_SIZE - mInSize); diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index c6e31af3c..32b1174c1 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -90,7 +90,8 @@ short packet_lengths[] = -1, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -const unsigned int BUFFER_SIZE = 655360; +const unsigned int BUFFER_SIZE = 1000000; +const unsigned int BUFFER_LIMIT = 930000; int networkThread(void *data) { @@ -421,6 +422,13 @@ void Network::receive() case 1: // Receive data from the socket SDL_mutexP(mMutex); + if (mInSize > BUFFER_LIMIT) + { + SDL_mutexV(mMutex); + SDL_Delay(100); + continue; + } + ret = SDLNet_TCP_Recv(mSocket, mInBuffer + mInSize, BUFFER_SIZE - mInSize); |