X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Fbriskin5%2FObj%2Fbriskin5.phh;h=6e3a52f77328c1604a69673089713a55c6add1cf;hb=9a17da4020740578e3a744630fd6be96c8237cab;hp=daf02b3a6b7cbd88477104167b2ee7204e9a3468;hpb=1cc28eaacbcb2e5a5b3a788d17d39b66fb8898f7;p=brisk.git diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index daf02b3..6e3a52f 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -503,7 +503,7 @@ class Bin5_user extends User { } */ - 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); @@ -525,7 +525,7 @@ class Bin5_user extends User { 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; @@ -801,28 +801,7 @@ class Bin5 { 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(); @@ -852,6 +831,8 @@ class Bin5 { $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"); } @@ -888,6 +869,9 @@ class Bin5 { /* 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]; @@ -895,7 +879,7 @@ class Bin5 { ($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') { @@ -931,6 +915,7 @@ class Bin5 { $ismod = TRUE; } + $this->delay_mgr->lastcheck_set($curtime); return ($ismod); } @@ -1109,7 +1094,7 @@ class Bin5 { $dt, $user->flags, xcape($user->name), xcape($user_mesg)); $user_cur->step_inc(); } - log_legal($curtime, 'xxx', $user, ($user->stat == 'room' ? 'room' : 'table '.$user->table_orig),$user_mesg); + log_legal($curtime, $user->ip, $user, ($user->stat == 'room' ? 'room' : 'table '.$user->table_orig),$user_mesg); } } @@ -1168,6 +1153,8 @@ class Bin5 { 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); @@ -1199,7 +1186,7 @@ class Bin5 { $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; @@ -1219,7 +1206,7 @@ class Bin5 { 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; @@ -1231,8 +1218,8 @@ class Bin5 { || ($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; @@ -1247,7 +1234,7 @@ class Bin5 { $content = ""; $user->stream_init($s_a_p->rndstr, $enc, $header_out, $content, $get, $post, $cookie); - $response = headers_render($header_out, -1).chunked_content($user->rd_zls_get(), $content); + $response = headers_render($header_out, -1).$user->chunked_content($content); $response_l = mb_strlen($response, "ASCII"); $wret = @fwrite($new_socket, $response, $response_l); @@ -1261,7 +1248,7 @@ class Bin5 { 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; @@ -1428,7 +1415,7 @@ function show_table(&$bri, &$user, $sendstep, $is_transition, $is_again) $ret .= "setTimeout(preload_images, 500, g_preload_img_arr, g_imgct);"; } if (!$is_again) - $ret .= table_wellcome($user); + $ret .= table_welcome($user); if ($is_transition && !$is_again) { // appena seduti al tavolo, play della mucca $ret .= playsound("cow.mp3"); @@ -1690,7 +1677,7 @@ function show_table_info(&$bri, &$table, $table_pos) } $old_multer = $table->multer(FALSE); if ($old_multer > 1) { - $noty .= sprintf($mlang_bin5_bin5['info_omul'][$G_lang], $old_multer); + $noty .= sprintf($mlang_bin5_bin5['info_omul'][$G_lang], multoval($old_multer)); } $noty .= "

"; } @@ -1723,7 +1710,7 @@ function show_table_info(&$bri, &$table, $table_pos) $multer = $table->multer(TRUE); if ($multer > 1) { - $noty .= sprintf($mlang_bin5_bin5['info_mult'][$G_lang], $multer ); + $noty .= sprintf($mlang_bin5_bin5['info_mult'][$G_lang], multoval($multer) ); } $noty .= "

"; $ret .= show_notify($noty, 3000, $mlang_bin5_bin5['btn_bkgame'][$G_lang], 500, 400); @@ -1737,7 +1724,7 @@ function show_table_info(&$bri, &$table, $table_pos) return ($ret); } -function table_wellcome($user) +function table_welcome($user) { GLOBAL $table_wellarr, $G_lang; $ret = "";