*/
function getPort ();
- /**
- * Getter for protocol
- *
- * @return $protocol Used protocol
- */
- function getProtocol ();
-
/**
* Getter for IP address
*
* stack.
*
* @param $helperInstance An instance of a Helper class
- * @param $protocol Name of used protocol (TCP/UDP)
* @return void
*/
- function enqueueRawDataFromTemplate (Helper $helperInstance, $protocol);
+ function enqueueRawDataFromTemplate (Helper $helperInstance);
/**
* Checks whether a package has been enqueued for delivery.
function getPort ();
/**
- * Getter for protocol
+ * Getter for protocol name
*
- * @return $protocol Used protocol
+ * @return $protocol Name of used protocol
*/
- function getProtocol ();
+ function getProtocolName ();
}
// [EOF]
* Chooses the right protocol from given package data
*
* @param $packageData Raw package data
- * @return $protocolName Name of the choosen procotol
+ * @return $protocolInstance An instance of a ProtocolHandler class
*/
function chooseProtocolFromPackageData (array $packageData);
*/
private $assemblerInstance = NULL;
+ /**
+ * Name of used protocol
+ */
+ private $protocolName = 'invalid';
+
/**
* Protected constructor
*
// Return result
return $stateName;
}
+
+ /**
+ * Getter for protocol name
+ *
+ * @return $protocolName Name of used protocol
+ */
+ public final function getProtocolName () {
+ return $this->protocolName;
+ }
+
+ /**
+ * Setter for protocol name
+ *
+ * @param $protocolName Name of used protocol
+ * @return void
+ */
+ protected final function setProtocolName ($protocolName) {
+ $this->protocolName = $protocolName;
+ }
}
// [EOF]
/**
* Determines the protoctol name
*
- * @param $packageData Valid package data
- * @return $protocolName Name of used protocol (TCP/UDP/etc.)
+ * @param $packageData Valid package data
+ * @return $protocolInstance An instance of a ProtocolHandler class
*/
protected function determineProtocolByPackageData (array $packageData) {
// First we need a tags instance
* and if so we can re-use it. If there is no socket registered, we try
* to make a new connection (TCP or UDP) to the given IP:port.
*/
- $protocolName = $tagsInstance->chooseProtocolFromPackageData($packageData);
+ $protocolInstance = $tagsInstance->chooseProtocolFromPackageData($packageData);
// Return it
- return $protocolName;
+ return $protocolInstance;
}
/**
* Creates a valid socket resource from given packae data and protocol
*
* @param $packageData Raw package data
- * @param $protocolName Protocol name (TCP/UDP)
+ * @param $protocolInstance An instance of a ProtocolHandler class
* @return $socketResource Socket resource
*/
- public static function createSocketFromPackageData (array $packageData, $protocolName) {
+ public static function createSocketFromPackageData (array $packageData, ProtocolHandler $protocolInstance) {
// Get an instance
$factoryInstance = new SocketFactory();
// Construct registry key
- $registryKey = 'socket_' . $protocolName . '_' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT];
+ $registryKey = 'socket_' . $protocolInstance->getProtocolName() . '_' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT];
// Debug message
//*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Trying to find a socket with registryKey=' . $registryKey);
//*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Using socket ' . $socketResource . '(' . gettype($socketResource) . ') from registry.');
} else {
// Construct configuration entry for object factory and get it
- $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry($protocolName . '_connection_helper_class');
+ $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry($protocolInstance->getProtocolName() . '_connection_helper_class');
// Debug message
//*NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: Going to use class ' . $className . ' for creating a socket resource ...');
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
parent::__construct(__CLASS__);
// Set protocol
- $this->setProtocol('!!!');
+ $this->setProtocolName('!!!');
}
/**
*/
const CONNECTION_TYPE_SERVER = 'server';
- /**
- * Protocol used
- */
- private $protocol = 'invalid';
-
/**
* Port number used
*/
$this->port = $port;
}
- /**
- * Getter for protocol
- *
- * @return $protocol Used protocol
- */
- public final function getProtocol () {
- return $this->protocol;
- }
-
- /**
- * Setter for protocol
- *
- * @param $protocol Used protocol
- * @return void
- */
- protected final function setProtocol ($protocol) {
- $this->protocol = $protocol;
- }
-
/**
* Getter for IP address
*
assert(strlen($rawData) > 0);
// Calculate buffer size
- $bufferSize = $this->getConfigInstance()->getConfigEntry($this->getProtocol() . '_buffer_length');
+ $bufferSize = $this->getConfigInstance()->getConfigEntry($this->getProtocolName() . '_buffer_length');
// Encode the raw data with our output-stream
$encodedData = $this->getOutputStreamInstance()->streamData($rawData);
parent::__construct(__CLASS__);
// Set protocol
- $this->setProtocol('tcp');
+ $this->setProtocolName('tcp');
}
/**
parent::__construct(__CLASS__);
// Set protocol
- $this->setProtocol('udp');
+ $this->setProtocolName('udp');
}
/**
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
// Debug message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('HELPER[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!');
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_|||);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Next, feed the content in. The network package class is a pipe-through class.
- $packageInstance->enqueueRawDataFromTemplate($this, NetworkPackage::PROTOCOL_TCP);
+ $packageInstance->enqueueRawDataFromTemplate($this);
}
}
const EXCEPTION_FINAL_CHUNK_VERIFICATION = 0xa07;
const EXCEPTION_INVALID_DATA_CHECKSUM = 0xa08;
- /**
- * Used protocol (Default: invalid, which is indeed invalid...)
- */
- private $protocol = 'invalid';
-
/**
* Address (IP mostly) we shall listen on
*/
$this->setListenPort($this->getConfigInstance()->getConfigEntry($configEntry));
}
- /**
- * Setter for protocol
- *
- * @param $protocol Used protocol
- * @return void
- */
- protected final function setProtocol ($protocol) {
- $this->protocol = (string) $protocol;
- }
-
- /**
- * Getter for protocol
- *
- * @return $protocol Used protocol
- */
- public final function getProtocol () {
- return $this->protocol;
- }
-
/**
* Setter for blocking-mode
*
*/
public function accept (Visitor $visitorInstance) {
// Debug message
- //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($this->getProtocol()) . '-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - START');
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - START');
// Visit this listener
$visitorInstance->visitListener($this);
} // END - if
// Debug message
- //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($this->getProtocol()) . '-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - FINISHED');
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(strtoupper($this->getProtocolName()) . '-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - FINISHED');
}
/**
return $this->getListenerInstance()->getPort();
}
- /**
- * Getter for protocol
- *
- * @return $protocol The used protocol
- */
- public final function getProtocol () {
- return $this->getListenerInstance()->getProtocol();
- }
-
/**
* Accepts the visitor to process the visit "request"
*
parent::__construct(__CLASS__);
// Set the protocol to TCP
- $this->setProtocol('tcp');
+ $this->setProtocolName('tcp');
}
/**
$packageData = array(
NetworkPackage::PACKAGE_DATA_SENDER => $peerName . ':0',
NetworkPackage::PACKAGE_DATA_RECIPIENT => $this->getSessionId(),
- NetworkPackage::PACKAGE_DATA_PROTOCOL => $this->getProtocol(),
+ NetworkPackage::PACKAGE_DATA_PROTOCOL => $this->getProtocolName(),
NetworkPackage::PACKAGE_DATA_STATUS => NetworkPackage::PACKAGE_STATUS_FAKED
);
parent::__construct(__CLASS__);
// Set the protocol to UDP
- $this->setProtocol('udp');
+ $this->setProtocolName('udp');
}
/**
* stack.
*
* @param $helperInstance An instance of a Helper class
- * @param $protocol Name of used protocol (TCP/UDP)
* @return void
*/
- public function enqueueRawDataFromTemplate (Helper $helperInstance, $protocolName) {
+ public function enqueueRawDataFromTemplate (Helper $helperInstance) {
+ // Get protocol instance for recipient
+ $protocolInstance = ProtocolHandlerFactory::createProtocolFromRecipientHelper($helperInstance);
+
// Get the raw content ...
$content = $helperInstance->getTemplateInstance()->getRawTemplateData();
//* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('content(' . strlen($content) . ')=' . $content);
$this->getStackInstance()->pushNamed(self::STACKER_NAME_UNDECLARED, array(
self::PACKAGE_DATA_SENDER => $this->getSessionId(),
self::PACKAGE_DATA_RECIPIENT => $helperInstance->getRecipientType(),
- self::PACKAGE_DATA_PROTOCOL => $protocolName,
+ self::PACKAGE_DATA_PROTOCOL => $protocolInstance->getProtocolName(),
self::PACKAGE_DATA_CONTENT => $packageContent,
self::PACKAGE_DATA_STATUS => self::PACKAGE_STATUS_NEW,
self::PACKAGE_DATA_SIGNATURE => $this->generatePackageSignature($packageContent, $this->getSessionId())
*/
public function addListener (Listenable $listenerInstance) {
// Add this listener instance to the instance list
- parent::addInstance($listenerInstance->getProtocol(), 'listener', $listenerInstance);
+ parent::addInstance($listenerInstance->getProtocolName(), 'listener', $listenerInstance);
// Debug message
self::createDebugInstance(__CLASS__)->debugOutput(
// Get protocol and port number and add both together
$key = sprintf("%s:%s:%s",
$connectionInstance->__toString(),
- $connectionInstance->getProtocol(),
+ $connectionInstance->getProtocolName(),
$connectionInstance->getPort()
);
*/
private function getRegistryKeyFromProtocol (ConnectionHelper $connectionInstance) {
// Get the key
- $key = $connectionInstance->getProtocol();
+ $key = $connectionInstance->getProtocolName();
// Return resulting key
return $key;
}
// Get protocol and port number and add both together
- $key = sprintf("%s:%s:%s:%s",
+ $key = sprintf('%s:%s:%s:%s',
$protocolInstance->__toString(),
- $protocolInstance->getProtocol(),
+ $protocolInstance->getProtocolName(),
$address,
$protocolInstance->getPort()
);
*/
private function getRegistryKeyFromProtocol (ProtocolHandler $protocolInstance) {
// Get the key
- $key = $protocolInstance->getProtocol();
+ $key = $protocolInstance->getProtocolName();
// Return resulting key
return $key;
*/
private function isProtocolRegistered (ProtocolHandler $protocolInstance) {
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocol() . ' - ENTERED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocolName() . ' - ENTERED!');
// Get the key
$key = $this->getRegistryKeyFromProtocol($protocolInstance);
$isRegistered = $this->instanceExists($key);
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocol() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocolName() . ',isRegistered=' . intval($isRegistered) . ' - EXIT!');
// Return result
return $isRegistered;
*/
public function isSocketRegistered (ProtocolHandler $protocolInstance, $socketResource) {
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocol() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ' - ENTERED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocolName() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ' - ENTERED!');
// Default is not registered
$isRegistered = FALSE;
$key = $this->getRegistryKeyFromProtocol($protocolInstance);
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: protocol=' . $protocolInstance->getProtocol() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',key=' . $key . ' - Trying to get instance ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: protocol=' . $protocolInstance->getProtocolName() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',key=' . $key . ' - Trying to get instance ...');
// Get the registry
$registryInstance = $this->getInstance($key);
$socketKey = $this->getSubRegistryKey($protocolInstance);
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: protocol=' . $protocolInstance->getProtocol() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',key=' . $key . ',socketKey=' . $socketKey . ' - Checking existence ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: protocol=' . $protocolInstance->getProtocolName() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',key=' . $key . ',socketKey=' . $socketKey . ' - Checking existence ...');
// Is it there?
if ($registryInstance->instanceExists($socketKey)) {
} // END - if
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocol() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',isRegistered=' . intval($isRegistered) . ' - EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocolName() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',isRegistered=' . intval($isRegistered) . ' - EXIT!');
// Return the result
return $isRegistered;
*/
public function registerSocket (ProtocolHandler $protocolInstance, $socketResource, array $packageData = array()) {
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocol() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ' - ENTERED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocolName() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ' - ENTERED!');
// Is the socket already registered?
if ($this->isSocketRegistered($protocolInstance, $socketResource)) {
*/
public function getRegisteredSocketResource (ProtocolHandler $protocolInstance) {
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocol() . ' - ENTERED!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocolName() . ' - ENTERED!');
// The socket must be registered before we can return it
if (!$this->isProtocolRegistered($protocolInstance)) {
$socketResource = $registryInstance->getInstance($socketKey)->getSocketResource();
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocol() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ' - EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']:protocol=' . $protocolInstance->getProtocolName() . ',socketResource[' . gettype($socketResource) . ']=' . $socketResource . ' - EXIT!');
// Return the resource
return $socketResource;
// Init source
$sourceInstance->initSource('crawler', 'uploaded_list');
- // Get a
+ // Get a ??? @TODO
+
// Return the prepared instance
return $sourceInstance;
}
public static function isConnectRetryExhausted (ConnectionHelper $helperInstance) {
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - ENTERED!');
// Construct config entry
- $configEntry = $helperInstance->getProtocol() . '_connect_retry_max';
+ $configEntry = $helperInstance->getProtocolName() . '_connect_retry_max';
// Check it out
$isExhausted = (
(
- isset(self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'])
+ isset(self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'])
) && (
- self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'] >= $helperInstance->getConfigInstance()->getConfigEntry($configEntry)
+ self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] >= $helperInstance->getConfigInstance()->getConfigEntry($configEntry)
)
);
public static function increaseConnectRetry (ConnectionHelper $helperInstance) {
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - ENTERED!');
// Is the counter there
- if (!isset(self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'])) {
+ if (!isset(self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'])) {
// First attempt
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - FIRST!');
- self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count'] = 1;
+ self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] = 1;
} else {
// Next attempt
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-STATISTICS[' . __METHOD__ . ':' . __LINE__ . ']: helperInstance=' . $helperInstance->__toString() . ' - INCREMENT!');
- self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['retry_count']++;
+ self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count']++;
}
// Create/update 'last_update' for purging
// @TODO last_update is not being used at the moment
- self::$connectionStatistics[$helperInstance->getProtocol()][$helperInstance->__toString()]['last_update'] = time();
+ self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['last_update'] = time();
}
}
const EXCEPTION_INVALID_TAG = 0x160;
/**
- * Last found protocol
+ * Last found protocol instance
*/
- private $lastProtocol = 'invalid';
+ private $lastProtocol = NULL;
/**
* Last found recipient type
} // END - if
// Now save the last discovered protocol/recipient type
- $this->lastProtocol = $entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_PROTOCOL];
+ $this->lastProtocol = ProtocolHandlerFactory::createProtocolHandlerFromArray($entry);
$this->lastRecipientType = $entry[XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_RECIPIENT_TYPE];
} // END - foreach
}
* Chooses the right protocol from given package data
*
* @param $packageData Raw package data
- * @return $protocolName Name of the choosen procotol
+ * @return $lastProtocol An instance of the last used ProtocolHandler class
*/
public function chooseProtocolFromPackageData (array $packageData) {
// Extract the tags
// Now we need to verify every single tag
$this->verifyAllTags();
- // Use the last found protocol for transmission
- $protocolName = $this->lastProtocol;
-
// Return it
- return $protocolName;
+ return $this->lastProtocol;
}
/**
-Subproject commit 80d808f788a6b4712bc7a33abcfcc8bb432cbdf9
+Subproject commit 68bd2250d706545928c5882c34265ceae3e2f03f