Change network resource handling in the internals of Predis\Connection.

This commit is contained in:
Daniele Alessandri
2011-03-06 15:03:07 +01:00
parent c03ab9480e
commit 235d311cb1
+5 -3
View File
@@ -1333,7 +1333,7 @@ class Connection implements IConnection {
}
public function isConnected() {
return is_resource($this->_socket);
return isset($this->_socket);
}
public function connect() {
@@ -1395,6 +1395,7 @@ class Connection implements IConnection {
public function disconnect() {
if ($this->isConnected()) {
fclose($this->_socket);
unset($this->_socket);
}
}
@@ -1490,9 +1491,10 @@ class Connection implements IConnection {
}
public function getSocket() {
if (!$this->isConnected()) {
$this->connect();
if (isset($this->_socket)) {
return $this->_socket;
}
$this->connect();
return $this->_socket;
}