summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/socket.c14
-rw-r--r--src/common/socket.h1
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