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 02:08:08 +0300
commit0983fb8a5a159951523acb4af365345feb7b5b69 (patch)
tree1ead940cf113ea937063d049bbe7658faef3ca40
parentb4dcdb89cfe1b59bda35ae0cb60148dc7727fec2 (diff)
downloadplus-mageia2.tar.gz
plus-mageia2.tar.bz2
plus-mageia2.tar.xz
plus-mageia2.zip
Increase buffers size and flush send buffer if it too big.mageia2
-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 790611381..258796575 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -45,6 +45,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 5d5a84a64..9c84b2e25 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -87,7 +87,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
{
@@ -487,4 +488,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 c0ec6ef3c..823c8cf66 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
{