* don't hang if connection isn't made
git-svn-id: svn://netflint.net/xmpphp@18 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
parent
912a17ac07
commit
e36fc08eb0
@ -38,7 +38,7 @@ class Logging {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function log($msg, $runlevel=Null) {
|
function log($msg, $runlevel=Null) {
|
||||||
if(!$runlevel) $runlevel = LOGGING_INFO;
|
if($runlevel === Null) $runlevel = LOGGING_INFO;
|
||||||
$data[] = array($this->runlevel, $msg);
|
$data[] = array($this->runlevel, $msg);
|
||||||
if($this->printout and $runlevel <= $this->runlevel) print "{$this->names[$runlevel]}: $msg\n";
|
if($this->printout and $runlevel <= $this->runlevel) print "{$this->names[$runlevel]}: $msg\n";
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,10 @@ class XMLStream {
|
|||||||
}
|
}
|
||||||
$this->log->log("Connecting to tcp://{$this->host}:{$this->port}");
|
$this->log->log("Connecting to tcp://{$this->host}:{$this->port}");
|
||||||
$this->socket = stream_socket_client("tcp://{$this->host}:{$this->port}", $flags=$conflag);
|
$this->socket = stream_socket_client("tcp://{$this->host}:{$this->port}", $flags=$conflag);
|
||||||
|
if(!$this->socket) {
|
||||||
|
$this->log->log("Could not connect.", LOGGING_ERROR);
|
||||||
|
$this->disconnected = True;
|
||||||
|
}
|
||||||
stream_set_blocking($this->socket, 1);
|
stream_set_blocking($this->socket, 1);
|
||||||
if($sendinit) $this->send($this->stream_start);
|
if($sendinit) $this->send($this->stream_start);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user