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)) {
+ $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 ($content == "" && $user->ping_req == FALSE
+ && (($this->curtime - $user->lacc) > (EXPIRE_TIME_RD / 2))) {
+ $content = $user->stream_ping();
+ $user->ping_req = TRUE;
+ }
if ($content == "" && $user->rd_kalive_is_expired($this->curtime)) {
$content = $user->stream_keepalive();
}
// -->
</script>", $this->rd_scristp++));
+}
+
+function stream_ping()
+{
+ return (sprintf("<script id='hs%d' type='text/javascript'><!--
+push(\"act_ping();\");
+// -->
+</script>", $this->rd_scristp++));
+
}
static function base_get()
{
GLOBAL $G_base, $G_dbasetype;
+ $curtime = time();
if ($bri == NULL) {
return FALSE;
}
log_wr('POSTSPLIT: '.$argz[0].' user->stat: ['.$user->stat.']');
log_wr($user->step, 'bin::index_wr.php: after get_user()');
- if (false && $argz[0] == 'shutdown') {
+ if ($argz[0] == 'ping') {
+ $user->lacc = $curtime;
+ }
+ else if (false && $argz[0] == 'shutdown') {
log_auth($user_cur->sess, "Shutdown session. delegate to room gc the autologout");
log_rd2("bin5/index_wr.php: AUTO LOGOUT.");
$pt_cur = calculate_points(&$table);
$plist = "$table->table_token|$user->table_orig|$table->player_n";
- $curtime = time();
$ucodes = array();
for ($i = 0 ; $i < BIN5_PLAYERS_N ; $i++) {
$user_cur = &$bri->user[$table->player[$i]];
}
/* Stat: ROOM */
+function act_ping()
+{
+ send_mesg("ping");
+}
+
function act_sitdown(table)
{
send_mesg("sitdown|"+table);
log_wr($user->step, 'index_wr.php: after get_user()');
- if ($argz[0] == 'shutdown') {
+ if ($argz[0] == 'ping') {
+ $user->lacc = $curtime;
+ }
+ else if ($argz[0] == 'shutdown') {
log_auth($user->sess, "Shutdown session.");
$user->reset();