summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-06 10:57:31 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-12-06 10:57:31 +0000
commit23867efcc4336f811cf6c424a62110d514ee8293 (patch)
tree4673f54ec683ac6772ec3d3534d29d088ea916cf /src/common/socket.c
parent49b620d06a9b5c835e97aa238b42d5d56743e6fb (diff)
downloadhercules-23867efcc4336f811cf6c424a62110d514ee8293.tar.gz
hercules-23867efcc4336f811cf6c424a62110d514ee8293.tar.bz2
hercules-23867efcc4336f811cf6c424a62110d514ee8293.tar.xz
hercules-23867efcc4336f811cf6c424a62110d514ee8293.zip
- Messages with server_tick field are sent as soon as possible now.
This might fix client synchronization issues. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9415 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/socket.c')
-rw-r--r--src/common/socket.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index bedad4ed0..dcaf2cdf2 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -687,7 +687,7 @@ int realloc_writefifo(int fd, size_t addition)
return 0;
}
-int WFIFOSET(int fd,int len)
+int _WFIFOSET(int fd, int len, char flush)
{
size_t newreserve;
struct socket_data *s = session[fd];
@@ -712,7 +712,9 @@ int WFIFOSET(int fd,int len)
// 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);
- if(s->wdata_size >= frame_size)
+ if( flush )
+ flush_fifo(fd);
+ else if(s->wdata_size >= frame_size)
send_from_fifo(fd);
// realloc after sending
@@ -807,7 +809,7 @@ int do_sendrecv(int next)
if(session[i]->wdata_size && session[i]->func_send)
session[i]->func_send(i);
- if(session[i]->eof) //The session check is for when the connection ended in func_parse
+ if(session[i] && session[i]->eof) //The session check is for when the connection ended in func_parse
{ //Finally, even if there is no data to parse, connections signalled eof should be closed, so we call parse_func [Skotlex]
if (session[i]->func_parse)
session[i]->func_parse(i); //This should close the session inmediately.