From 53cfab85f158d82c149753fe1ea90fa45a14e7c5 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Mon, 15 Oct 2012 07:36:35 +0200 Subject: [PATCH] more clear and consistent ping timeout check --- web/Obj/sac-a-push.phh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/Obj/sac-a-push.phh b/web/Obj/sac-a-push.phh index a06ef40..7a99c87 100644 --- a/web/Obj/sac-a-push.phh +++ b/web/Obj/sac-a-push.phh @@ -429,15 +429,19 @@ class Sac_a_push { if (isset($this->s2u[intval($sock)])) { $user = $this->s2u[intval($sock)]; $response = $user->rd_cache_get(); - if (($this->curtime - $user->lacc) <= (EXPIRE_TIME_RD / 2)) { + $do_ping = FALSE; + if (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 3)) { + $do_ping = TRUE; + } + else { $user->ping_req = FALSE; } + if ($response == "") { $content = ""; $user->stream_main($content, $get, $post, $cookie); printf("[%s] [%d] [%d]\n", $user->name, $user->lacc, $this->curtime); - if ($user->ping_req == FALSE - && (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 2))) { + if ($do_ping && $user->ping_req == FALSE) { $content .= $user->stream_keepalive(TRUE); $user->ping_req = TRUE; } -- 2.17.1