* 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:
fritzy 2008-04-07 04:06:03 +00:00
parent 912a17ac07
commit e36fc08eb0
2 changed files with 5 additions and 1 deletions

View File

@ -38,7 +38,7 @@ class Logging {
}
function log($msg, $runlevel=Null) {
if(!$runlevel) $runlevel = LOGGING_INFO;
if($runlevel === Null) $runlevel = LOGGING_INFO;
$data[] = array($this->runlevel, $msg);
if($this->printout and $runlevel <= $this->runlevel) print "{$this->names[$runlevel]}: $msg\n";
}

View File

@ -84,6 +84,10 @@ class XMLStream {
}
$this->log->log("Connecting to tcp://{$this->host}:{$this->port}");
$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);
if($sendinit) $this->send($this->stream_start);
}