From: Matteo Nastasi Date: Mon, 30 Jul 2012 07:42:48 +0000 (+0200) Subject: manage partial write into index_rd_ifra request X-Git-Tag: v4.0.0~77 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=2dc9ca73362637289206af0d5cf29cd3cd03ebb7;p=brisk.git manage partial write into index_rd_ifra request --- diff --git a/web/spush/brisk-spush.php b/web/spush/brisk-spush.php index db8724e..6f2ce08 100755 --- a/web/spush/brisk-spush.php +++ b/web/spush/brisk-spush.php @@ -262,9 +262,18 @@ function main() $user->rd_socket_set(NULL); } - $body = ""; - index_rd_ifra_init($room, $user, $header_out, $body, $get, $post, $cookie); - fwrite($new_socket, headers_render($header_out).$body); + $content = ""; + index_rd_ifra_init($room, $user, $header_out, $content, $get, $post, $cookie); + $content_l = mb_strlen($content, "ASCII"); + + $wret = @fwrite($new_socket, headers_render($header_out).$content); + if ($wret < $content_l) { + printf("TROUBLES WITH FWRITE: %d\n", $ret); + $user->rd_cache_set(mb_substr($content, $ret, $content_l - $ret, "ASCII")); + } + else { + $user->rd_cache_set(""); + } fflush($new_socket); $s2u[intval($new_socket)] = $idx;