]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 10 May 2022 23:46:00 +0000 (01:46 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 10 May 2022 23:50:59 +0000 (01:50 +0200)
- $encodedData was used twice, ops!
- logging improved

Signed-off-by: Roland Häder <roland@mxchange.org>
application/hub/classes/container/socket/class_SocketContainer.php
application/hub/classes/helper/connection/class_BaseConnectionHelper.php

index 7e72cfe8ad5abd638ed338142d5c09420b1f1d08..94970a1672f6f462deb7f35913a4b2ac4610a4a4 100644 (file)
@@ -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);
 
index 896fddb24b381a543f087c899857680281e9bdfc..9c72c2e30ac129b342a40f11dfa946efc158bd81 100644 (file)
@@ -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