}
*/
- function spawn($from, &$bri, $table, $table_pos, $get, $post, $cookie)
+ static function spawn($from, &$bri, $table, $table_pos, $get, $post, $cookie)
{
if (($thiz = new Bin5_user()) == FALSE)
return (FALSE);
log_wr("Bin5 constructor");
- $this->privflags = ($CO_bin5_pref_ring_endauct == "true" ? BIN5_USER_FLAG_RING_ENDAUCT : 0) | 0;
+ $thiz->privflags = ($CO_bin5_pref_ring_endauct == "true" ? BIN5_USER_FLAG_RING_ENDAUCT : 0) | 0;
$thiz->table_orig = $table;
$thiz->table = 0;
var $the_end;
var $tok;
- static function page_manager($room, $header_out, $path, $method, $addr, $get, $post, $cookie)
- {
- switch ($path) {
- case "":
- case "index.php":
- ob_start();
- bin5_index_main($room, $header_out, $addr, $get, $post, $cookie);
- $content = ob_get_contents();
- ob_end_clean();
-
- force_no_cache($header_out);
-
- $pgflush = new PageFlush($new_socket, $curtime, 20, $header_out, $content);
-
- if ($pgflush->try_flush($curtime) == FALSE) {
- // Add $pgflush to the pgflush array
- array_push($pages_flush, $pgflush);
- }
- break;
- }
- return TRUE;
- }
+ var $delay_mgr;
function Bin5 ($room, $table_idx, $table_token, $get, $post, $cookie) {
$this->user = array();
$this->table_token = $table_token;
$this->garbage_timeout = 0;
+ $this->delay_mgr = new Delay_Manager((GARBAGE_TIMEOUT *3.0) / 2.0);
+
log_wr("Bin5 constructor end");
}
/* Garbage collector degli utenti in timeout */
$ismod = FALSE;
$curtime = time();
+
+ $delta = $this->delay_mgr->delta_get($curtime);
+
if ($force || $this->garbage_timeout < $curtime) {
for ($i = 0 ; $i < BIN5_MAX_PLAYERS ; $i++) {
$user_cur = $this->user[$i];
($user_cur->stat == 'table' && ($user_cur->subst == 'shutdowned' || $user_cur->subst == 'shutdowner')))
continue;
- if ($user_cur->lacc + EXPIRE_TIME_RD < $curtime) { // Auto logout dell'utente
+ if ($user_cur->lacc + EXPIRE_TIME_RD < ($curtime - $delta)) { // Auto logout dell'utente
log_rd2($user_cur->sess." bin5 AUTO LOGOUT.");
if ($user_cur->stat == 'table') {
$ismod = TRUE;
}
+ $this->delay_mgr->lastcheck_set($curtime);
return ($ismod);
}
static function request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie)
{
+ GLOBAL $G_black_list;
+
printf("NEW_SOCKET (root): %d\n", intval($new_socket));
$enc = get_encoding($header);
$content = ob_get_contents();
ob_end_clean();
- $s_a_p->pgflush_try_add($enc, $new_socket, 20, $header_out, $content);
+ $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content);
return TRUE;
break;
else {
$content = "Bin5 Load data error";
}
- $s_a_p->pgflush_try_add($enc, $new_socket, 20, $header_out, $content);
+ $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content);
return TRUE;
break;
|| ($bri = $s_a_p->app->match_get($table_idx, $table_token)) == NULL
|| (($user = $bri->get_user($cookie['sess'], $idx)) == FALSE)) {
- $content = Bin5_user::stream_fini($s_a_p->rndstr, TRUE);
- $s_a_p->pgflush_try_add($enc, $new_socket, 20, $header_out, $content);
+ $content = Bin5_user::stream_fini($transp_type, $s_a_p->rndstr, TRUE);
+ $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content);
return TRUE;
break;
fflush($new_socket);
- $s_a_p->socks_set($new_socket, $user);
+ $s_a_p->socks_set($new_socket, $user, NULL);
$user->rd_socket_set($new_socket);
printf(" - qui ci siamo - ");
return TRUE;