From cb0a7d2568702826016699ac2f4d2c2cfdd66dcc Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Thu, 7 Feb 2013 09:19:56 +0100 Subject: [PATCH] pendpage_try_addflush signature changed --- web/Obj/brisk.phh | 13 ++++++++++--- web/Obj/sac-a-push.phh | 16 ++++++++-------- web/briskin5/Obj/briskin5.phh | 6 +++--- web/spush/brisk-spush.phh | 2 +- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 36060d8..ad293ed 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -2215,17 +2215,24 @@ class Room $content = ob_get_contents(); ob_end_clean(); - $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content); + fprintf(STDERR, "\n\nCONTENT [%s]\n\n", $content); + $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content); return TRUE; break; case "index_wr.php": + // + // Enhance required: in the POST case, after the header you must get content + // from the socket, waiting if necessary + // + + fprintf(STDERR, "\n\nDENTRO QUI\n\n"); ob_start(); index_wr_main($this, $addr, $get, $post, $cookie); $content = ob_get_contents(); ob_end_clean(); - $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content); + $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content); return TRUE; break; @@ -2238,7 +2245,7 @@ class Room $content = User::stream_fini($transp, $s_a_p->rndstr, TRUE); - $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content); + $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content); return TRUE; break; diff --git a/web/Obj/sac-a-push.phh b/web/Obj/sac-a-push.phh index fe8ec42..a69ea1d 100644 --- a/web/Obj/sac-a-push.phh +++ b/web/Obj/sac-a-push.phh @@ -489,19 +489,19 @@ class Sac_a_push { unset($this->socks[$id]); } - function pendpage_try_addflush($enc, &$new_socket, $tout, $header_out, $content) + function pendpage_try_addflush(&$new_socket, $tout, $enc, $header_out, $content) { - $pgflush = PendingPage::pendingpage_flushing($new_socket, $enc, $this->curtime, $tout, $header_out, $content); + $pendpage = PendingPage::pendingpage_flushing($new_socket, $this->curtime, $tout, $enc, $header_out, $content); - if ($pgflush->try_flush($this->curtime) == FALSE) { - // Add $pgflush to the pgflush array - $this->pgflush_add($pgflush); + if ($pendpage->try_flush($this->curtime) == FALSE) { + // Add $pendpage to the pendpage array + $this->pendpage_add($pendpage); } } - function pgflush_add($pgflush) + function pendpage_add($pendpage) { - array_push($this->pending_pages, $pgflush); + array_push($this->pending_pages, $pendpage); } function garbage_manager($force) @@ -560,7 +560,7 @@ class Sac_a_push { } $write = NULL; $except = NULL; - $num_changed_sockets = @stream_select($read, $write, $except, 0, 500000); + $num_changed_sockets = @stream_select($read, $write, $except, 5, 500000); if ($num_changed_sockets == 0) { printf(" no data in 5 secs, splash [%d]\n", $G_with_splash); diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 9f22a62..f1c119a 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -1184,7 +1184,7 @@ class Bin5 { $content = ob_get_contents(); ob_end_clean(); - $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content); + $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content); return TRUE; break; @@ -1204,7 +1204,7 @@ class Bin5 { else { $content = "Bin5 Load data error"; } - $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content); + $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content); return TRUE; break; @@ -1217,7 +1217,7 @@ class Bin5 { || (($user = $bri->get_user($cookie['sess'], $idx)) == FALSE)) { $content = Bin5_user::stream_fini($transp_type, $s_a_p->rndstr, TRUE); - $s_a_p->pendpage_try_addflush($enc, $new_socket, 20, $header_out, $content); + $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content); return TRUE; break; diff --git a/web/spush/brisk-spush.phh b/web/spush/brisk-spush.phh index 3de49ef..7f95316 100644 --- a/web/spush/brisk-spush.phh +++ b/web/spush/brisk-spush.phh @@ -58,7 +58,7 @@ class PendingPage { // if timeout or max content dimension is exceeded move to flushing } - static function pendingpage_flushing($socket, $enc, $curtime, $kalive, $header_out, $body) + static function pendingpage_flushing($socket, $curtime, $kalive, $enc, $header_out, $body) { $thiz = new PendingPage($socket); -- 2.17.1