Return stream_blocking and add false check

This commit is contained in:
Ivan Borzenkov 2010-03-10 00:01:19 +03:00
parent 6abf075531
commit eb08b045c3

View File

@ -457,8 +457,15 @@ class XMPPHP_XMLStream {
} else if ($updated > 0) { } else if ($updated > 0) {
$buff = ''; $buff = '';
do { 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); $part = fread($this->socket, 4096);
if (!$part) { stream_set_blocking($this->socket, 1);
if ($part === false) {
if($this->reconnect) { if($this->reconnect) {
$this->doReconnect(); $this->doReconnect();
} else { } else {