diff --git a/XMPPHP/XMLStream.php b/XMPPHP/XMLStream.php index 0ffec4d..d818881 100644 --- a/XMPPHP/XMLStream.php +++ b/XMPPHP/XMLStream.php @@ -457,8 +457,15 @@ class XMPPHP_XMLStream { } else if ($updated > 0) { $buff = ''; do { + if ($buff != '') { + //disable blocking for now because fread() will + // block until the 4k are full if we already + // read a part of the packet + stream_set_blocking($this->socket, 0); + } $part = fread($this->socket, 4096); - if (!$part) { + stream_set_blocking($this->socket, 1); + if ($part === false) { if($this->reconnect) { $this->doReconnect(); } else {