summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-10-31 20:17:38 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-10-31 20:17:38 +0000
commita0fb6bc388fb1d4f0fcfd7d3d8af71a9c8cf86ca (patch)
tree7f8807e77b9e1b1da7cc0439241aabe5f362c45c /src/common/socket.c
parente6d41bc71fcc2ddc2e9370f5325f67c07d347ccf (diff)
downloadhercules-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/socket.c')
-rw-r--r--src/common/socket.c14
1 files changed, 11 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);