$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;
}
// 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()));
/* 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
*/
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
// 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;
}
// 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', '');
-Subproject commit 08578b5e2e37e31e45d24c17c01a6b8bc0abd53b
+Subproject commit d06cac435541022230e4bda9ad28cd75b41907a4