From 7323652f15ee07682a687b6e959a486743ba17a5 Mon Sep 17 00:00:00 2001 From: Ilya Lifshitz Date: Wed, 4 Mar 2015 11:37:32 +0200 Subject: [PATCH] Change answer reader script in Socket.php Sometimes it stuck in infinitive loop. Signed-off-by:Ilya Lifshitz --- src/Racecore/GATracking/Client/Adapter/Socket.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Racecore/GATracking/Client/Adapter/Socket.php b/src/Racecore/GATracking/Client/Adapter/Socket.php index 1be002e..7e74e49 100644 --- a/src/Racecore/GATracking/Client/Adapter/Socket.php +++ b/src/Racecore/GATracking/Client/Adapter/Socket.php @@ -73,19 +73,13 @@ private function readConnection(Request\TrackingRequest $request) return false; } - $payloadString = http_build_query($request->getPayload()); - $payloadLength = strlen($payloadString); - // response $response = ''; // receive response - $read = 0; - do { - $buf = fread($this->connection, $payloadLength - $read); - $read += strlen($buf); - $response .= $buf; - } while ($read < $payloadLength); + while (!feof($this->connection)) { + $response .= fread($this->connection, 8192); + } // response $responseContainer = explode("\r\n\r\n", $response, 2);