*/
function getConnectionPort ();
+ /**
+ * Getter for connection type
+ *
+ * @return $type Type of connection
+ */
+ function getConnectionType ();
+
/**
* Getter for IP address
*
*/
function getListenPort ();
+ /**
+ * Getter for connection type
+ *
+ * @return $connectionType Connection type for this listener
+ */
+ function getConnectionType ();
+
/**
* Getter for peer pool instance
*
return $this->poolInstance;
}
+ /**
+ * Getter for connection type
+ *
+ * @return $connectionType Connection type for this listener
+ */
+ public final function getConnectionType () {
+ // Wrap the real getter
+ return $this->getProtocolName();
+ }
+
/**
* Registeres the given socket resource for "this" listener instance. This
* will be done in a seperate class to allow package writers to use it
return $this->getListenerInstance()->getListenPort();
}
+ /**
+ * Getter for connection type
+ *
+ * @return $connectionType Connection type for this listener
+ */
+ public final function getConnectionType () {
+ return $this->getListenerInstance()->getConnectionType();
+ }
+
/**
* Accepts the visitor to process the visit "request"
*
* @return void
*/
protected final function addInstance ($group, $poolName, Visitable $visitableInstance) {
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: group=' . $group . ',poolName=' . $poolName . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: group=' . $group . ',poolName=' . $poolName . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
// Make sure the group is not 'invalid'
assert($group != 'invalid');
// Add it to given pool group
$this->getPoolEntriesInstance()->addInstance($group, $poolName, $visitableInstance);
+
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!');
}
/**
* @return $key A string representation of the socket for the registry
*/
private function getSubRegistryKey (ConnectionHelper $connectionInstance) {
+ // Debug message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: connectionInstance=' . $connectionInstance->__toString() . ' CALLED!');
+
// Get connection type and port number and add both together
$key = sprintf('%s:%s:%s',
$connectionInstance->__toString(),
$connectionInstance->getConnectionPort()
);
+ // Debug message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: key=' . $key . ' - EXIT!');
+
// Return resulting key
return $key;
}
* @return $key A string representation of the socket for the registry
*/
private function getSubRegistryKey (Listenable $connectionInstance) {
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: connectionInstance=' . $connectionInstance->__toString() . ' - ENTERED!');
+
// Default address is invalid
$address = '*invalid*';
$port = 0;
$this->debugBackTrace('Unsupported connectionInstance=' . $connectionInstance->__toString() . ' detected. Please fix this!');
}
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: address=' . $address . ',port=' . $port);
+
// Get connection type and port number and add both together
$key = sprintf('%s:%s:%s:%s',
$connectionInstance->__toString(),
$port
);
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: key=' . $key . ' - EXIT!');
+
// Return resulting key
return $key;
}
* @return $key A string representation of the listener for the registry
*/
private function getRegistryKeyFromListener (Listenable $listenerInstance) {
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: listenerInstance=' . $listenerInstance->__toString() . ' - ENTERED!');
+
// Get the key
$key = $listenerInstance->getConnectionType();
+ // Debug message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: key=' . $key . ' - EXIT!');
+
// Return resulting key
return $key;
}