From: Matteo Nastasi Date: Sun, 16 Jul 2017 15:26:22 +0000 (+0200) Subject: send last command on transport channel before logout with relative infrastructure X-Git-Tag: v5.4.2~1 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=0678cbbbbf7ba11361b8716258302e276570b73e;p=brisk.git send last command on transport channel before logout with relative infrastructure --- diff --git a/INSTALL.sh b/INSTALL.sh index 4dd75ee..01289c6 100755 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -425,7 +425,7 @@ sed -i "s@var \+cookiepath \+= \+\"[^\"]*\";@var cookiepath = \"$prefix_path\";@ sed -i "s@\( \+cookiepath *: *\)\"[^\"]*\" *,@\1 \"$prefix_path\",@g" ${web_path}__/xynt-streaming.js document_root="$(grep DocumentRoot "${apache_conf}" | grep -v '^[ ]*#' | awk '{ print $2 }')" -sed -i "s@^\(\$DOCUMENT_ROOT *= *[\"']\)[^\"']*\([\"']\)@\1$document_root\2@g" ${web_path}__/spush/*.ph* +sed -i "s@^\(\$DOCUMENT_ROOT *= *[\"']\)[^\"']*\([\"']\)@\1$document_root\2@g" ${web_path}__/spush/*.ph* ${web_path}__/donometer.php if [ -d ../brisk-img ]; then cd ../brisk-img diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index bd834d8..0b9ead0 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -1226,10 +1226,15 @@ class Brisk function users_cleanup() { + $curtime = time(); for ($i = 0 ; $i < MAX_PLAYERS ; $i++) { $user_cur = $this->user[$i]; - if ($user_cur->the_end) { + if ($user_cur->the_end + && (($user_cur->rd_toflush == FALSE + && $user_cur->rd_step == $user_cur->step) + || $user_cur->rd_endtime_is_expired($curtime)) + ) { $user_cur->reset(); // users_cleanup, OK } } diff --git a/web/Obj/sac-a-push.phh b/web/Obj/sac-a-push.phh index a3fe932..b4ec956 100644 --- a/web/Obj/sac-a-push.phh +++ b/web/Obj/sac-a-push.phh @@ -631,14 +631,18 @@ class Sac_a_push { foreach ($this->socks as $k => $sock) { $id = intval($sock); if (isset($this->s2u[$id])) { - if ($this->s2u[$id]->the_end) { - if ($this->s2u[$id]->rd_socket_get() != NULL) { - $this->s2u[$id]->rd_socket_set(NULL); + $user = $this->s2u[$id]; + if ($user->the_end) { + if (($user->rd_toflush == FALSE && $user->rd_step == $user->step) + || $user->rd_endtime_is_expired($this->curtime)) { + if ($user->rd_socket_get() != NULL) { + $user->rd_socket_set(NULL); + } + unset($this->socks[$id]); + unset($this->s2u[$id]); + fclose($sock); + printf("CLOSE ON GARBAGE MANAGER\n"); } - unset($this->socks[$id]); - unset($this->s2u[$id]); - fclose($sock); - printf("CLOSE ON GARBAGE MANAGER\n"); } } } diff --git a/web/donometer.php b/web/donometer.php index 76e5091..98a9895 100644 --- a/web/donometer.php +++ b/web/donometer.php @@ -23,6 +23,7 @@ */ $G_base = ""; +$DOCUMENT_ROOT=""; require_once("Obj/brisk.phh"); diff --git a/web/index_wr.php b/web/index_wr.php index c427c3d..2b97b93 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -954,16 +954,13 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) } else if ($argz[0] == 'logout') { $brisk->ghost_sess->push($curtime, $user->sess, GHOST_SESS_REAS_LOUT); + $user->the_end = TRUE; + $brisk->room_outstandup($user); - if ($user->subst == 'sitdown') { - log_load("ROOM WAKEUP"); - $brisk->room_wakeup($user); - } - else if ($user->subst == 'standup') - $brisk->room_outstandup($user); - else - log_rd2("LOGOUT FROM WHAT ???"); + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + $user->comm[$user->step % COMM_N] .= sprintf('gst.st_loc++; xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'); + $user->step_inc(); } } /********************** @@ -982,9 +979,13 @@ function index_wr_main(&$brisk, $remote_addr_full, $get, $post, $cookie) } else if ($argz[0] == 'logout') { $brisk->ghost_sess->push($curtime, $user->sess, GHOST_SESS_REAS_LOUT); - $user->the_end = TRUE; + $user->the_end = TRUE; $brisk->room_wakeup($user); + + $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; "; + $user->comm[$user->step % COMM_N] .= sprintf('gst.st_loc++; xstm.stop(); window.onbeforeunload = null; window.onunload = null; document.location.assign("index.php");'); + $user->step_inc(); } } }