THRIFT-347. php: PHP TSocket Timeout Issues
This patch appears to correct the infamous timeout issues.
Patch: Tyler Hobbs
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1036684 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/php/src/transport/TSocket.php b/lib/php/src/transport/TSocket.php
index bbe1987..6fd4825 100644
--- a/lib/php/src/transport/TSocket.php
+++ b/lib/php/src/transport/TSocket.php
@@ -241,9 +241,9 @@
$pre = null;
while (TRUE) {
$buf = @fread($this->handle_, $len);
- if ($buf === FALSE || $buf === '') {
+ if ($buf === FALSE) {
$md = stream_get_meta_data($this->handle_);
- if ($md['timed_out']) {
+ if (true === $md['timed_out'] && false === $md['blocked']) {
throw new TTransportException('TSocket: timed out reading '.$len.' bytes from '.
$this->host_.':'.$this->port_);
} else {
@@ -252,7 +252,7 @@
}
} else if (($sz = strlen($buf)) < $len) {
$md = stream_get_meta_data($this->handle_);
- if ($md['timed_out']) {
+ if (true === $md['timed_out'] && false === $md['blocked']) {
throw new TTransportException('TSocket: timed out reading '.$len.' bytes from '.
$this->host_.':'.$this->port_);
} else {
@@ -277,9 +277,9 @@
$this->sendTimeoutSet_ = FALSE;
}
$data = @fread($this->handle_, $len);
- if ($data === FALSE || $data === '') {
+ if ($data === FALSE) {
$md = stream_get_meta_data($this->handle_);
- if ($md['timed_out']) {
+ if (true === $md['timed_out'] && false === $md['blocked']) {
throw new TTransportException('TSocket: timed out reading '.$len.' bytes from '.
$this->host_.':'.$this->port_);
} else {