Merging PHP transport changes from www trunk to thrift trunk
Summary: Some empty() fixes, plus a few other socket helpers
Reviewed By: lucas
Test Plan: Use the transports to make IPC calls!
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665331 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/php/src/transport/TSocket.php b/lib/php/src/transport/TSocket.php
index cce3a44..e1bd3bd 100644
--- a/lib/php/src/transport/TSocket.php
+++ b/lib/php/src/transport/TSocket.php
@@ -28,7 +28,7 @@
/**
* Remote hostname
- *
+ *
* @var string
*/
protected $host_ = 'localhost';
@@ -128,6 +128,24 @@
}
/**
+ * Get the host that this socket is connected to
+ *
+ * @return string host
+ */
+ public function getHost() {
+ return $this->host_;
+ }
+
+ /**
+ * Get the remote port that this socket is connected to
+ *
+ * @return int port
+ */
+ public function getPort() {
+ return $this->port_;
+ }
+
+ /**
* Tests whether this is open
*
* @return bool true if the socket is open
@@ -140,6 +158,7 @@
* Connects the socket.
*/
public function open() {
+
if ($this->persist_) {
$this->handle_ = @pfsockopen($this->host_,
$this->port_,
@@ -162,7 +181,7 @@
}
throw new TException($error);
}
-
+
stream_set_timeout($this->handle_, 0, $this->sendTimeout_*1000);
$this->sendTimeoutSet_ = TRUE;
}
@@ -176,7 +195,7 @@
$this->handle_ = null;
}
}
-
+
/**
* Uses stream get contents to do the reading
*