summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-10 19:13:12 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-10 19:13:12 +0000
commit46ff3c574337c625551f20682a90cc1faf342618 (patch)
tree70f1a38dee557dadf93c9091288f5a4c7357ad97 /src
parent6432636534237ae5986414355dc8f2a1d46bea27 (diff)
downloadhercules-46ff3c574337c625551f20682a90cc1faf342618.tar.gz
hercules-46ff3c574337c625551f20682a90cc1faf342618.tar.bz2
hercules-46ff3c574337c625551f20682a90cc1faf342618.tar.xz
hercules-46ff3c574337c625551f20682a90cc1faf342618.zip
- The interserver outgoing buffer now gets flushed when it reaches 512KB of data stored on it.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11886 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/common/socket.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index 9907845eb..966e27626 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -210,9 +210,9 @@ int send_from_fifo(int fd)
return 0;
}
- // some data could not be transferred?
if( len > 0 )
{
+ // some data could not be transferred?
// shift unsent data to the beginning of the queue
if( (size_t)len < session[fd]->wdata_size )
memmove(session[fd]->wdata, session[fd]->wdata + len, session[fd]->wdata_size - len);
@@ -507,6 +507,11 @@ int WFIFOSET(int fd, size_t len)
}
s->wdata_size += len;
+ //If the interserver has 200% of its normal size full, flush the data.
+ if(s->max_wdata >= FIFOSIZE_SERVERLINK &&
+ s->wdata_size >= 2*FIFOSIZE_SERVERLINK)
+ flush_fifo(fd);
+
// always keep a WFIFO_SIZE reserve in the buffer
// For inter-server connections, let the reserve be 1/4th of the link size.
newreserve = s->wdata_size + (s->max_wdata >= FIFOSIZE_SERVERLINK ? FIFOSIZE_SERVERLINK / 4 : WFIFO_SIZE);