From 133995b848e3fce1790148cc625047857362aae2 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 29 Jan 2008 11:04:21 +0000 Subject: - Cleaned socket.c to use flag.server when detecting inter-server connections. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12147 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/socket.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/common/socket.c') diff --git a/src/common/socket.c b/src/common/socket.c index 9bc49a3e0..7f7160f26 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -575,17 +575,9 @@ int realloc_writefifo(int fd, size_t addition) while( session[fd]->wdata_size + addition > newsize ) newsize += newsize; } else - if( session[fd]->max_wdata >= FIFOSIZE_SERVERLINK) - { - //Inter-server adjust. [Skotlex] - if ((session[fd]->wdata_size+addition)*4 < session[fd]->max_wdata) - newsize = session[fd]->max_wdata / 2; - else - return 0; //No change - } - else - if( session[fd]->max_wdata > WFIFO_SIZE && (session[fd]->wdata_size+addition)*4 < session[fd]->max_wdata ) - { // shrink rule, shrink by 2 when only a quater of the fifo is used, don't shrink below 4*addition + if( session[fd]->max_wdata >= 2*(session[fd]->flag.server?FIFOSIZE_SERVERLINK:WFIFO_SIZE) + && (session[fd]->wdata_size+addition)*4 < session[fd]->max_wdata ) + { // shrink rule, shrink by 2 when only a quarter of the fifo is used, don't shrink below nominal size. newsize = session[fd]->max_wdata / 2; } else // no change @@ -648,13 +640,12 @@ 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) + if( s->flag.server && 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); + newreserve = s->wdata_size + ( s->flag.server ? FIFOSIZE_SERVERLINK / 4 : WFIFO_SIZE); // readjust the buffer to the newly chosen size realloc_writefifo(fd, newreserve); -- cgit v1.2.3-60-g2f50