From: Roland Haeder Date: Sat, 15 Feb 2014 23:09:00 +0000 (+0100) Subject: This needs to be copied to a local variable or else with debug lines the code won... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=35961eab3fcbe05c3dbc812e0f8eac5b3ff520b9;p=hub.git This needs to be copied to a local variable or else with debug lines the code won't work. :-( Signed-off-by: Roland Haeder --- diff --git a/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php b/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php index 828d5d1ea..aedbb2693 100644 --- a/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php +++ b/application/hub/main/handler/network/tcp/class_TcpRawDataHandler.php @@ -75,12 +75,15 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { */ $rawData = socket_read($socketArray[BasePool::SOCKET_ARRAY_RESOURCE], $this->getConfigInstance()->getConfigEntry('tcp_buffer_length'), PHP_BINARY_READ); + // Get socket error code back + $socketError = socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]); + // Debug output of read data length - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-HANDLER[' . __LINE__ . ']: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE] . ',error=' . socket_strerror(socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-HANDLER[' . __LINE__ . ']: rawData[' . gettype($rawData) . ']=' . strlen($rawData) . ',MD5=' . md5($rawData) . ',resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE] . ',error=' . socket_strerror($socketError)); /* NOISY-DEBUG: */ if ($rawData !== FALSE) self::createDebugInstance(__CLASS__)->debugOutput('TCP-HANDLER[' . __LINE__ . ']: rawData=' . $rawData); // Is it valid? - if (socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]) == 11) { + if ($socketError == 11) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('TCP-HANDLER[' . __LINE__ . ']: Ignoring error 11 (Resource temporary unavailable) from socket resource=' . $socketArray[BasePool::SOCKET_ARRAY_RESOURCE]); @@ -93,9 +96,9 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable { // Skip any further processing return; - } elseif (($rawData === FALSE) || (socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE]) > 0)) { + } elseif (($rawData === FALSE) || ($socketError > 0)) { // Network error or connection lost - $this->setErrorCode(socket_last_error($socketArray[BasePool::SOCKET_ARRAY_RESOURCE])); + $this->setErrorCode($socketError); } elseif (empty($rawData)) { // The peer did send nothing to us which is now being ignored return;