diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-19 15:44:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-19 15:44:41 +0300 |
commit | 94d65b487d458341e3626bcfa41fa09c1c240d89 (patch) | |
tree | debf415d1ee3314a6a746fc4fe8f296f4f8f5472 /src/net/eathena | |
parent | 1768a3c449f0bb9ac1533781f5134eebe0f9c458 (diff) | |
download | ManaVerse-94d65b487d458341e3626bcfa41fa09c1c240d89.tar.gz ManaVerse-94d65b487d458341e3626bcfa41fa09c1c240d89.tar.bz2 ManaVerse-94d65b487d458341e3626bcfa41fa09c1c240d89.tar.xz ManaVerse-94d65b487d458341e3626bcfa41fa09c1c240d89.zip |
Flush send buffer if it too big.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/messageout.cpp | 1 | ||||
-rw-r--r-- | src/net/eathena/network.cpp | 11 | ||||
-rw-r--r-- | src/net/eathena/network.h | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp index 795807a3f..a486a02f5 100644 --- a/src/net/eathena/messageout.cpp +++ b/src/net/eathena/messageout.cpp @@ -45,6 +45,7 @@ MessageOut::MessageOut(short id): Net::MessageOut(id) { mNetwork = EAthena::Network::instance(); + mNetwork->fixSendBuffer(); mData = mNetwork->mOutBuffer + mNetwork->mOutSize; writeInt16(id); diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index e7e15d8e4..d01613075 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -525,4 +525,15 @@ uint16_t Network::readWord(int pos) #endif } +void Network::fixSendBuffer() +{ + if (mOutSize > BUFFER_LIMIT) + { + if (mState != CONNECTED) + mOutSize = 0; + else + flush(); + } +} + } // namespace EAthena diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index 4a7f41c09..1fdcf7c6e 100644 --- a/src/net/eathena/network.h +++ b/src/net/eathena/network.h @@ -86,6 +86,8 @@ class Network void flush(); + void fixSendBuffer(); + // ERROR replaced by NET_ERROR because already defined in Windows enum { |