]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 16 Dec 2021 14:32:09 +0000 (15:32 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 16 Dec 2021 14:32:09 +0000 (15:32 +0100)
- *_socket_listen_backlog is now being "cached" in static array to avoid some
  "expensive" invocations on configuration class
- updated 'core' framework

Signed-off-by: Roland Häder <roland@mxchange.org>
application/hub/classes/container/socket/class_SocketContainer.php
application/hub/classes/handler/package/class_NetworkPackageHandler.php
application/hub/classes/tools/hub/class_HubTools.php
application/hub/config.php
core

index e574a84b830c6c578d24233859d09872228fe799..dce21206b8f3fac1f0adc5b0a8d852e2060a4c71 100644 (file)
@@ -176,6 +176,9 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita
                $socketInstance->setPackageDataInstance($packageInstance);
                $socketInstance->setSocketType($socketType);
 
+               // Set more configuration entries
+               self::$configEntries[sprintf('%s_socket_listen_backlog', $socketInstance->getSocketType())] = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry(sprintf('%s_socket_listen_backlog', $socketInstance->getSocketProtocol()));
+
                // Return the prepared instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: socketInstance=%s - EXIT!', strtoupper($socketProtocol), $socketInstance->__toString()));
                return $socketInstance;
@@ -569,7 +572,7 @@ class SocketContainer extends BaseHubContainer implements StorableSocket, Visita
                }
 
                // Try to listen on socket
-               $result = socket_listen($this->getSocketResource(), FrameworkBootstrap::getConfigurationInstance()->getConfigEntry(sprintf('%s_socket_listen_backlog', $this->getSocketProtocol())));
+               $result = socket_listen($this->getSocketResource(), self::$configEntries[sprintf('%s_socket_listen_backlog', $this->getSocketType())]);
 
                // Return result
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
index 39730da4f92c909bf941327417a7e59eb95e8688..a40593e613ab6e7c5137906159ae399971e99ce1 100644 (file)
@@ -849,7 +849,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: content(%d)=%s', strlen($content), $content));
                if (empty($content)) {
                        // Abort here
-                       throw new UnexpectedValueException('content cannot be empty.');
+                       throw new UnexpectedValueException('Parameter "content" is empty');
                }
 
                // ... and compress it
index cfe20d60b9dfc90ed127fd7202a5da4a7a9d3b4c..6bd85854db727a77453e4bffb878c1ee3203fd49 100644 (file)
@@ -215,9 +215,10 @@ class HubTools extends BaseHubSystem {
         */
        public static function resolveSessionIdToUnl (string $address) {
                // Is the parameter valid?
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: address=%s - CALLED!', $address));
                if (empty($address)) {
                        // No empty address
-                       throw new InvalidArgumentException('Parameter "address" cannot be empty');
+                       throw new InvalidArgumentException('Parameter "address" is empty');
                }
 
                // Get an own instance
@@ -232,20 +233,19 @@ class HubTools extends BaseHubSystem {
                        // Direct Universal Node Locator found
                        self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Direct Universal Node Locator ' . $address . ' detected.');
                } elseif (preg_match('/([a-f0-9]{' . $selfInstance->getSessionIdLength() . '})/', $address)) {
-                       // Debug message
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Using internal session id resolver.');
-
                        // Resolve session id into an instance of a LocateableNode class
+                       /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Using internal session id resolver.');
                        $recipient = $selfInstance->resolveUniversalNodeLocatorBySessionId($address);
 
                        // Debug message
-                       self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Session id ' . $address . ' resolved to ' . $recipient);
+                       /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-TOOLS: Session id ' . $address . ' resolved to ' . $recipient);
                } else {
                        // Invalid session id/UNL
                        throw new InvalidSessionIdException($address, self::EXCEPTION_SESSION_ID_IS_INVALID);
                }
 
                // Return it
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: recipient=%s - EXIT!', $recipient));
                return $recipient;
        }
 
index 645baa12088b8625257fc0fd3d5d0ceba9129f70..c7a5d80eeb5bed38a745cdabae155d67bc0861eb 100644 (file)
@@ -802,6 +802,9 @@ $cfg->setConfigEntry('file_socket_listen_backlog', 0);
 // CFG: TCP-SOCKET-LISTEN-BACKLOG
 $cfg->setConfigEntry('tcp_socket_listen_backlog', 1000);
 
+// CFG: UDP-SOCKET-LISTEN-BACKLOG
+$cfg->setConfigEntry('udp_socket_listen_backlog', 1000);
+
 // CFG: EXTERNAL-ADDRESS
 $cfg->setConfigEntry('external_address', '');
 
diff --git a/core b/core
index 08578b5e2e37e31e45d24c17c01a6b8bc0abd53b..d06cac435541022230e4bda9ad28cd75b41907a4 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 08578b5e2e37e31e45d24c17c01a6b8bc0abd53b
+Subproject commit d06cac435541022230e4bda9ad28cd75b41907a4