From a3dd865033d13bc0c1d16128e4f30f647d741ff9 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Mon, 23 Jul 2012 15:56:41 +0200 Subject: [PATCH] first workaround for partial write of normal mages --- web/spush/brisk-spush.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/web/spush/brisk-spush.php b/web/spush/brisk-spush.php index b3c28eb..e77c1b2 100755 --- a/web/spush/brisk-spush.php +++ b/web/spush/brisk-spush.php @@ -23,6 +23,7 @@ * * TODO * + * - partial write for normal page management * - from room to table * - from table to room * - fwrite other issues @@ -202,8 +203,19 @@ function main() index_main($room, $header_out, $addr, $get, $post, $cookie); $content = ob_get_contents(); ob_end_clean(); - // printf("OUT: [%s]\n", $G_content); - fwrite($new_socket, headers_render($header_out).$content); + $content_sz = mb_strlen($content, "LATIN1"); + $hea = headers_render($header_out); + + // TODO: FIX THIS PART TO A SPAWN WRITE AS CUEUE. + printf("OUT: [%d]\n", $content_sz); + for ($w = 0 ; $w < 10 ; $w++) { + if (($wret = fwrite($new_socket, $content, $content_sz)) == $content_sz + || $wret <= 0) + break; + printf("wret: [%d]\n", $wret); + $content = substr($content, $wret, $content_sz - $wret); + usleep(100000); + } fclose($new_socket); break; case SITE_PREFIX."index_wr.php": -- 2.17.1