$discoveryInstance = new PackageSocketDiscovery();
// Output debug message
- self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: Initialized.');
+ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: Initialized.');
// Return the prepared instance
return $discoveryInstance;
*/
public function discoverListenerInstance ($protocolName, array $packageData) {
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: protocolName=' . $protocolName . ' - ENTERED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: protocolName=' . $protocolName . ' - ENTERED!');
/*
* Get the listener pool instance, we need to lookup the matching
*/
foreach ($poolInstance->getPoolEntriesInstance()->getArrayFromGroup($protocolName) as $listenerInstance) {
// Debug output
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: protocolName=' . $protocolName . ',listenerInstance=' . $listenerInstance->__toString());
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: protocolName=' . $protocolName . ',listenerInstance=' . $listenerInstance->__toString());
// Does the listener want that package?
if ($listenerInstance->ifListenerAcceptsPackageData($packageData)) {
// This listener likes our package data, so abort here
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: Listener is accepting package data.');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: Listener is accepting package data.');
break;
} // END - if
// Debug output
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: Listener is NOT accepting package data.');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: Listener is NOT accepting package data.');
} // END - foreach
// Return it
// Try to create a new socket resource
try {
// Possibly noisy debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: Trying to establish a ' . strtoupper($protocolName) . ' connection to ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' ...');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: Trying to establish a ' . strtoupper($protocolName) . ' connection to ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' ...');
// Get a socket resource from our factory (if succeeded)
$socketResource = SocketFactory::createSocketFromPackageData($packageData, $protocolName);
} catch (SocketConnectionException $e) {
// The connection fails of being established, so log it away
- self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: Caught ' . $e->__toString() . ',message=' . $e->getMessage());
+ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: Caught ' . $e->__toString() . ',message=' . $e->getMessage());
}
} // END - if
$helperInstance = Registry::getRegistry()->getInstance('connection');
// Possibly noisy debug message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: Going to resolve socket from peer state and given package data ...');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: Going to resolve socket from peer state and given package data ...');
// Resolve the peer's state (but ignore return value)
PeerStateResolver::resolveStateByPackage($helperInstance, $packageData, $socketResource);
} catch (InvalidSocketException $e) {
// This cannot be fixed, so log it away
- self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: Cannot discover socket resource for recipient ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ': ' . $e->getMessage());
+ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: Cannot discover socket resource for recipient ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ': ' . $e->getMessage());
// Make any failed attempts to 'false'
$socketResource = false;
}
// And return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY: socketResource=' . $socketResource . ',packageData=' . print_r($packageData, true));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __LINE__ . ']: socketResource=' . $socketResource . ',packageData=' . print_r($packageData, true));
return $socketResource;
}
}