diff options
author | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-10-31 20:17:38 +0000 |
---|---|---|
committer | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-10-31 20:17:38 +0000 |
commit | a0fb6bc388fb1d4f0fcfd7d3d8af71a9c8cf86ca (patch) | |
tree | 7f8807e77b9e1b1da7cc0439241aabe5f362c45c /src/common | |
parent | e6d41bc71fcc2ddc2e9370f5325f67c07d347ccf (diff) | |
download | hercules-a0fb6bc388fb1d4f0fcfd7d3d8af71a9c8cf86ca.tar.gz hercules-a0fb6bc388fb1d4f0fcfd7d3d8af71a9c8cf86ca.tar.bz2 hercules-a0fb6bc388fb1d4f0fcfd7d3d8af71a9c8cf86ca.tar.xz hercules-a0fb6bc388fb1d4f0fcfd7d3d8af71a9c8cf86ca.zip |
Fixed bugreport:6779 dropped between-server ping timers, replaced by a much more reliable and performance-efficient on-demand flagging.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16854 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/socket.c | 14 | ||||
-rw-r--r-- | src/common/socket.h | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index 3d7bb66b4..d24a9c1d8 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -797,8 +797,13 @@ int do_sockets(int next) continue; if (session[i]->rdata_tick && DIFF_TICK(last_tick, session[i]->rdata_tick) > stall_time) { - ShowInfo("Session #%d timed out\n", i); - set_eof(i); + if( session[i]->flag.server ) {/* server is special */ + if( session[i]->flag.ping != 2 )/* only update if necessary otherwise it'd resend the ping unnecessarily */ + session[i]->flag.ping = 1; + } else { + ShowInfo("Session #%d timed out\n", i); + set_eof(i); + } } session[i]->func_parse(i); @@ -1073,8 +1078,11 @@ int socket_config_read(const char* cfgName) if(sscanf(line, "%[^:]: %[^\r\n]", w1, w2) != 2) continue; - if (!strcmpi(w1, "stall_time")) + if (!strcmpi(w1, "stall_time")) { stall_time = atoi(w2); + if( stall_time < 3 ) + stall_time = 3;/* a minimum is required to refrain it from killing itself */ + } #ifndef MINICORE else if (!strcmpi(w1, "enable_ip_rules")) { ip_rules = config_switch(w2); diff --git a/src/common/socket.h b/src/common/socket.h index 3265f6487..7c0e02f5d 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -76,6 +76,7 @@ struct socket_data struct { unsigned char eof : 1; unsigned char server : 1; + unsigned char ping : 2; } flag; uint32 client_addr; // remote client address |