From: Roland Häder Date: Tue, 10 May 2022 23:46:00 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e79ea5cb86c84957ac93e91fa1fe6ad3eccc2f0c;p=hub.git Continued: - $encodedData was used twice, ops! - logging improved Signed-off-by: Roland Häder --- diff --git a/application/hub/classes/container/socket/class_SocketContainer.php b/application/hub/classes/container/socket/class_SocketContainer.php index 7e72cfe8a..94970a167 100644 --- a/application/hub/classes/container/socket/class_SocketContainer.php +++ b/application/hub/classes/container/socket/class_SocketContainer.php @@ -980,6 +980,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita $sentBytes = socket_write($this->getSocketResource(), $socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA], $bufferSize); // Check if the operation was okay + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: sentBytes[%s]=%d', strtoupper($this->getSocketProtocol()), gettype($sentBytes), $sentBytes)); // @TODO Maybe check more? $result = ($sentBytes !== FALSE); diff --git a/application/hub/classes/helper/connection/class_BaseConnectionHelper.php b/application/hub/classes/helper/connection/class_BaseConnectionHelper.php index 896fddb24..9c72c2e30 100644 --- a/application/hub/classes/helper/connection/class_BaseConnectionHelper.php +++ b/application/hub/classes/helper/connection/class_BaseConnectionHelper.php @@ -365,10 +365,13 @@ abstract class BaseConnectionHelper extends BaseHubSystemHelper implements Visit $bufferSize = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($this->getProtocolName() . '_buffer_length'); // Encode the raw data with our output-stream - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CONNECTION-HELPER: bufferSize=%d,rawData()=%d, socketResource[%s]=%s', $bufferSize, strlen($rawData), gettype($this->getSocketInstance()->getSocketResource()), $this->getSocketInstance()->getSocketResource())); + $encodedData = $this->getOutputStreamInstance()->streamData($rawData); + + // Create data array + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CONNECTION-HELPER: bufferSize=%d,rawData()=%d, this->socketResource[%s]=%s', $bufferSize, strlen($rawData), gettype($this->getSocketInstance()->getSocketResource()), $this->getSocketInstance()->getSocketResource())); $encodedDataArray = [ NetworkPackageHandler::RAW_INDEX_FINAL_HASH => $this->currentFinalHash, - NetworkPackageHandler::RAW_INDEX_ENCODED_DATA => $this->getOutputStreamInstance()->streamData($rawData), + NetworkPackageHandler::RAW_INDEX_ENCODED_DATA => $encodedData, NetworkPackageHandler::RAW_INDEX_SENT_BYTES => 0, NetworkPackageHandler::RAW_INDEX_SOCKET_INSTANCE => $this->getSocketInstance(), NetworkPackageHandler::RAW_INDEX_BUFFER_SIZE => $bufferSize, @@ -376,7 +379,7 @@ abstract class BaseConnectionHelper extends BaseHubSystemHelper implements Visit ]; // Push raw data to the package's outgoing stack - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CONNECTION-HELPER: Pushing %d large array on stack %s ...', count($encodedDataArray), NetworkPackageHandler::STACKER_NAME_OUTGOING_STREAM)); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CONNECTION-HELPER: Pushing encodedDataArray()=%d on stack %s ...', count($encodedDataArray), NetworkPackageHandler::STACKER_NAME_OUTGOING_STREAM)); $this->getPackageHandlerInstance()->getStackInstance()->pushNamed(NetworkPackageHandler::STACKER_NAME_OUTGOING_STREAM, $encodedDataArray); // Trace message