summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-19 15:44:41 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-27 01:59:42 +0300
commit2a12f93949e18946e401534e8b722414c4109bfe (patch)
treef3dbc864577be472c9be317c781531484fa8237b
parent8bc4bd6a1180df29d55636793f0293bf575ea550 (diff)
downloadplus-2a12f93949e18946e401534e8b722414c4109bfe.tar.gz
plus-2a12f93949e18946e401534e8b722414c4109bfe.tar.bz2
plus-2a12f93949e18946e401534e8b722414c4109bfe.tar.xz
plus-2a12f93949e18946e401534e8b722414c4109bfe.zip
Increase buffers size and flush send buffer if it too big.
-rw-r--r--src/net/tmwa/messageout.cpp1
-rw-r--r--src/net/tmwa/network.cpp14
-rw-r--r--src/net/tmwa/network.h2
3 files changed, 16 insertions, 1 deletions
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index b6fcc09a1..c7af9baf6 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -43,6 +43,7 @@ MessageOut::MessageOut(short id):
Net::MessageOut(id)
{
mNetwork = TmwAthena::Network::instance();
+ mNetwork->fixSendBuffer();
mData = mNetwork->mOutBuffer + mNetwork->mOutSize;
writeInt16(id);
}
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 5beb05c20..783b4b773 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -85,7 +85,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;
namespace TmwAthena
{
@@ -482,4 +483,15 @@ Uint16 Network::readWord(int pos)
#endif
}
+void Network::fixSendBuffer()
+{
+ if (mOutSize > BUFFER_LIMIT)
+ {
+ if (mState != CONNECTED)
+ mOutSize = 0;
+ else
+ flush();
+ }
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h
index 757358c25..f5e070a72 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -87,6 +87,8 @@ class Network
void flush();
+ void fixSendBuffer();
+
// ERROR replaced by NET_ERROR because already defined in Windows
enum
{