'en' => '<br>You are being idle for ' ),
'tabtout_b'=> array( 'it' => ' minuti. <br><br>Quindi ritorni tra i <b>Giocatori in piedi</b>.',
'en' => ' minutes. <br><br>Then you return with the <b>standing players</b>.'),
+ 'sessmoved' => array( 'it' => '<br>Questa sessione è stata ripresa da un'altra finestra o da un altro dispositivo.<br>Questa pagina non è più collegata.<br><br>',
+ 'en' => '<br>This session has been resumed from another window or device.<br>This page is no longer connected.<br><br>'),
'tickmust' => array( 'it' => '<br>Per attivare il messaggio di segnalazione del tavolo occorre essere seduti.<br><br>',
'en' => '<br>To activate the signalling message of the table it\'s necessary to be sitting<br><br>'),
'tickjust' => array( 'it' => '<br>Il messaggio di segnalazione del tavolo è già attivato.<br><br> ',
function request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie)
{
GLOBAL $G_ban_list, $G_black_list, $G_cloud_smasher;
+ GLOBAL $mlang_brisk, $G_lang;
// printf("NEW_SOCKET (root): %d PATH [%s]\n", intval($new_socket), $path);
$this->sess_cur_set($user->sess);
// close a previous opened index_read_ifra socket, if exists
if (($prev = $user->rd_socket_get()) != NULL) {
- $s_a_p->socks_unset($user->rd_socket_get());
- fclose($user->rd_socket_get());
+ /* The previous stream is being replaced by this one. Up to
+ now its socket was closed without a word, and the client on
+ the other side reopened it, displacing the new one in turn:
+ two windows open on the same session bounced each other
+ forever, with a red indicator and no explanation. Now it is
+ dismissed: it stops the stream and shows a notice. It is
+ not sent back to the login, because the session is valid
+ and it would come back in, starting the bouncing again.
+ In the normal case - the same client reopening after having
+ given the connection up for lost - the message ends up on a
+ socket nobody reads any more, and does no harm. */
+ $bye = $user->stream_bye('xstm.stop(); '
+ .show_notify($mlang_brisk['sessmoved'][$G_lang], 0, "chiudi", 400, 120));
+ if ($bye != "") {
+ @fwrite($prev, $bye, mb_strlen($bye, "ASCII"));
+ }
+ $s_a_p->socks_unset($prev);
+ fclose($prev);
// printf("CLOSE AND OPEN AGAIN ON IFRA2\n");
$user->rd_socket_set(NULL);
}
return ($this->rd_transp->chunk( $this->rd_scristp++, ($with_ping ? "act_ping();" : NULL)));
}
+/* Farewell for the stream about to be replaced by another one: the message
+ is framed according to the transport of the OLD connection, which may differ
+ from the one of the new, and is followed by an orderly close. If the old
+ connection is already dead the write fails with no consequence. */
+function stream_bye($js)
+{
+ if ($this->rd_transp == NULL) {
+ return ("");
+ }
+ return ($this->chunked_content($this->rd_transp->chunk(0, $js)).$this->stream_close());
+}
+
function stream_close()
{
$clo = $this->rd_transp->close();
static function request_mgr(&$s_a_p, $header, &$header_out, &$new_socket, $path, $addr, $get, $post, $cookie)
{
GLOBAL $G_ban_list, $G_black_list;
+ GLOBAL $mlang_brisk, $G_lang;
// printf("NEW_SOCKET (root): %d\n", intval($new_socket));
// close a previous opened index_read_ifra socket, if exists
if (($prev = $user->rd_socket_get()) != NULL) {
- $s_a_p->socks_unset($user->rd_socket_get());
- fclose($user->rd_socket_get());
+ /* as in the room: the stream being replaced is told what
+ happened to it, otherwise it reopens and displaces the
+ new one in turn, forever. */
+ $bye = $user->stream_bye('xstm.stop(); '
+ .show_notify($mlang_brisk['sessmoved'][$G_lang], 0, "chiudi", 400, 120));
+ if ($bye != "") {
+ @fwrite($prev, $bye, mb_strlen($bye, "ASCII"));
+ }
+ $s_a_p->socks_unset($prev);
+ fclose($prev);
// printf("CLOSE AND OPEN AGAIN ON IFRA2\n");
$user->rd_socket_set(NULL);
}