From: Matteo Nastasi (mop) Date: Mon, 15 Oct 2012 05:36:35 +0000 (+0200) Subject: more clear and consistent ping timeout check X-Git-Tag: v4.0.0~36 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=53cfab85f158d82c149753fe1ea90fa45a14e7c5;p=brisk.git more clear and consistent ping timeout check --- 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; }