*/
private function setSocketOption ($level, $optionName, $optionValue) {
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: level=%s,optionName=%s,optionValue[%s]=%s - CALLED!', strtoupper($this->getSocketProtocol()), $level, $optionName, gettype($optionValue), $optionValue));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: level=%s,optionName=%s,optionValue[%s]=%s - CALLED!', strtoupper($this->getSocketProtocol()), $level, $optionName, gettype($optionValue), implode(',', $optionValue)));
// Should be valid socket
if (!$this->isValidSocket()) {
// Trace message
/* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-FACTORY: poolInstance=%s,socketInstance.socketResource=%s - CALLED!', $poolInstance->__toString(), $socketInstance->getSocketResource()));
+ // Get socket protocol
+ $socketProtocol = $socketInstance->getSocketProtocol();
+
// Is the an iterator instance?
- if (!Registry::getRegistry()->instanceExists('pool_iterator')) {
+ if (!Registry::getRegistry()->instanceExists('pool_iterator_' . $socketProtocol)) {
// Create iterator instance
- $iteratorInstance = $poolInstance->createListIteratorInstance('pool');
+ $iteratorInstance = $poolInstance->createListIteratorInstance($socketProtocol . '_pool');
// Now store it in registry
Registry::getRegistry()->addInstance('pool_iterator', $iteratorInstance);
} else {
// Get iterator from registry
- $iteratorInstance = Registry::getRegistry()->getInstance('pool_iterator');
+ $iteratorInstance = Registry::getRegistry()->getInstance('pool_iterator_' . $socketProtocol);
}
// Is it valid?
} // END - if
// Set timeout to configured seconds
- if (!$socketinstance->setSocketTimeoutOptions()) {
+ if (!$socketInstance->setSocketTimeoutOptions()) {
// Handle this socket error with a faked recipientData array
$socketInstance->handleSocketEror(__METHOD__, __LINE__, array('0.0.0.0', '0'));
} // END - if
*/
private function isInfoRegistered (ShareableInfo $infoInstance) {
// Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ' - CALLED!');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ' - CALLED!');
// Get the key
$key = $this->getRegistryKeyFromInfo($infoInstance);
$isRegistered = $this->instanceExists($key);
// Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!');
// Return result
return $isRegistered;
*/
public function isSocketRegistered (ShareableInfo $infoInstance, StorableSocket $socketInstance) {
// Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!');
// Default is not registered
$isRegistered = FALSE;
$key = $this->getRegistryKeyFromInfo($infoInstance);
// Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ' - Trying to get instance ...');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ' - Trying to get instance ...');
// Get the registry
$registryInstance = $this->getInstance($key);
$socketKey = $this->getSubRegistryKey($infoInstance);
// Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ',socketKey=' . $socketKey . ' - Checking existence ...');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: this=' . $this->__toString() . ',protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',key=' . $key . ',socketKey=' . $socketKey . ' - Checking existence ...');
// Is it there?
if ($registryInstance->instanceExists($socketKey)) {
} // END - if
// Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!');
// Return the result
return $isRegistered;
*/
public function registerSocketInstance (ShareableInfo $infoInstance, StorableSocket $socketInstance, array $packageData = array()) {
// Debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY: protocolName=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!');
// Is the socket already registered?
if ($this->isSocketRegistered($infoInstance, $socketInstance)) {
// CFG: POOL-ENTRIES-LIST-CLASS
$cfg->setConfigEntry('pool_entries_list_class', 'Hub\Lists\Pool\PoolEntriesList');
-// CFG: POOL-ITERATOR-CLASS
-$cfg->setConfigEntry('pool_iterator_class', 'CoreFramework\Iterator\DefaultIterator');
+// CFG: FILE-POOL-ITERATOR-CLASS
+$cfg->setConfigEntry('file_pool_iterator_class', 'CoreFramework\Iterator\DefaultIterator');
+
+// CFG: TCP-POOL-ITERATOR-CLASS
+$cfg->setConfigEntry('tcp_pool_iterator_class', 'CoreFramework\Iterator\DefaultIterator');
+
+// CFG: UDP-POOL-ITERATOR-CLASS
+$cfg->setConfigEntry('udp_pool_iterator_class', 'CoreFramework\Iterator\DefaultIterator');
// CFG: SHUTDOWN-POOL-ITERATOR-CLASS
$cfg->setConfigEntry('shutdown_pool_iterator_class', 'ShutdownPoolIterator');