debug logging in __process
darcs-hash:20080831012136-84dde-801afb153d5f5c761336394647788e99e845f4a6.gz
This commit is contained in:
parent
d5f83d9252
commit
f7865b1d41
|
@ -319,6 +319,8 @@ class XMPPHP_XMLStream {
|
||||||
|
|
||||||
private function __process($maximum=0) {
|
private function __process($maximum=0) {
|
||||||
|
|
||||||
|
$this->log->log("__process($maximum)", XMPPHP_Log::LEVEL_VERBOSE);
|
||||||
|
|
||||||
$remaining = $maximum;
|
$remaining = $maximum;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -336,20 +338,34 @@ class XMPPHP_XMLStream {
|
||||||
$secs = $remaining / 1000000;
|
$secs = $remaining / 1000000;
|
||||||
$usecs = $remaining % 1000000;
|
$usecs = $remaining % 1000000;
|
||||||
}
|
}
|
||||||
|
$this->log->log("stream_select(read, write, except, $secs, $usecs)", XMPPHP_Log::LEVEL_VERBOSE);
|
||||||
$updated = @stream_select($read, $write, $except, $secs, $usecs);
|
$updated = @stream_select($read, $write, $except, $secs, $usecs);
|
||||||
if ($updated > 0) {
|
if ($updated === false) {
|
||||||
|
$this->log->log("Error on stream_select()", XMPPHP_Log::LEVEL_VERBOSE);
|
||||||
|
if ($this->reconnect) {
|
||||||
|
$this->doReconnect();
|
||||||
|
} else {
|
||||||
|
$this->log->log("Giving up", XMPPHP_Log::LEVEL_VERBOSE);
|
||||||
|
fclose($this->socket);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if ($updated > 0) {
|
||||||
# XXX: Is this big enough?
|
# XXX: Is this big enough?
|
||||||
|
$this->log->log("Reading from socket", XMPPHP_Log::LEVEL_VERBOSE);
|
||||||
$buff = @fread($this->socket, 4096);
|
$buff = @fread($this->socket, 4096);
|
||||||
if(!$buff) {
|
if(!$buff) {
|
||||||
if($this->reconnect) {
|
if($this->reconnect) {
|
||||||
$this->doReconnect();
|
$this->doReconnect();
|
||||||
} else {
|
} else {
|
||||||
|
$this->log->log("Error on fread(), reconnect", XMPPHP_Log::LEVEL_VERBOSE);
|
||||||
fclose($this->socket);
|
fclose($this->socket);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->log->log("RECV: $buff", XMPPHP_Log::LEVEL_VERBOSE);
|
$this->log->log("RECV: $buff", XMPPHP_Log::LEVEL_VERBOSE);
|
||||||
xml_parse($this->parser, $buff, false);
|
xml_parse($this->parser, $buff, false);
|
||||||
|
} else {
|
||||||
|
# $updated == 0 means no changes during timeout.
|
||||||
}
|
}
|
||||||
$remaining -= (microtime() - $starttime);
|
$remaining -= (microtime() - $starttime);
|
||||||
} while (is_null($maximum) || $remaining > 0);
|
} while (is_null($maximum) || $remaining > 0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user