define('SESS_LEN', 13);
define('STREAM_TIMEOUT', 60);
/* FIXME: move to sac-a-push .phh */
+/* TIME_RD define the server-side timeout, after half of it a ping request
+ is sent to client, after this time the client is log out */
define('EXPIRE_TIME_RD', 180);
define('EXPIRE_TIME_SMAMMA', 360);
define('EXPIRE_TIME_WAG', 10);
$content = "";
$user->stream_main($content, $get, $post, $cookie);
printf("[%s] [%d] [%d]\n", $user->name, $user->lacc, $this->curtime);
- if (/* $content == "" && */ $user->ping_req == FALSE
+ if ($user->ping_req == FALSE
&& (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 2))) {
- // $content = $user->stream_keepalive(TRUE);
- $content += $user->stream_keepalive(TRUE);
+ $content .= $user->stream_keepalive(TRUE);
$user->ping_req = TRUE;
}
- if ($content == "" && $user->rd_kalive_is_expired($this->curtime)) {
+ else if ($content == "" && $user->rd_kalive_is_expired($this->curtime)) {
$content = $user->stream_keepalive(FALSE);
}
if ($content != "") {
function stream_keepalive($with_ping)
{
- return (sprintf("<script id='hs%d' type='text/javascript'><!--
+ $ret = (sprintf("<script id='hs%d' type='text/javascript'><!--
push(%s);
// -->
</script>", $this->rd_scristp++, ($with_ping ? "\"act_ping();\"" : "null")));
-
+
+ return ($ret);
}
static function base_get()
log_wr('POSTSPLIT: '.$argz[0]);
- log_wr($user->step, 'index_wr.php: after get_user()');
-
if ($argz[0] == 'ping') {
+ log_wr("PING RECEIVED, LACC UPDATED\n");
$user->lacc = $curtime;
}
else if ($argz[0] == 'shutdown') {