*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
private $listenerPoolInstance = NULL;
+ /**
+ * Fragmenter instance
+ */
+ private $fragmenterInstance = NULL;
+
+ /**
+ * Decoder instance
+ */
+ private $decoderInstance = NULL;
+
+ /**
+ * Assembler instance
+ */
+ private $assemblerInstance = NULL;
+
/**
* Protected constructor
*
return $this->listenerPoolInstance;
}
+ /**
+ * Setter for fragmenter instance
+ *
+ * @param $fragmenterInstance A Fragmentable instance
+ * @return void
+ */
+ protected final function setFragmenterInstance (Fragmentable $fragmenterInstance) {
+ $this->fragmenterInstance = $fragmenterInstance;
+ }
+
+ /**
+ * Getter for fragmenter instance
+ *
+ * @return $fragmenterInstance A Fragmentable instance
+ */
+ protected final function getFragmenterInstance () {
+ return $this->fragmenterInstance;
+ }
+
+ /**
+ * Setter for decoder instance
+ *
+ * @param $decoderInstance A Decodeable instance
+ * @return void
+ */
+ protected final function setDecoderInstance (Decodeable $decoderInstance) {
+ $this->decoderInstance = $decoderInstance;
+ }
+
+ /**
+ * Getter for decoder instance
+ *
+ * @return $decoderInstance A Decodeable instance
+ */
+ protected final function getDecoderInstance () {
+ return $this->decoderInstance;
+ }
+
+ /**
+ * Setter for assembler instance
+ *
+ * @param $assemblerInstance A Decodeable instance
+ * @return void
+ */
+ protected final function setAssemblerInstance (Assembler $assemblerInstance) {
+ $this->assemblerInstance = $assemblerInstance;
+ }
+
+ /**
+ * Getter for assembler instance
+ *
+ * @return $assemblerInstance A Decodeable instance
+ */
+ protected final function getAssemblerInstance () {
+ return $this->assemblerInstance;
+ }
+
+ /**
+ * Setter for node id
+ *
+ * @param $nodeId Our new node id
+ * @return void
+ */
+ protected final function setNodeId ($nodeId) {
+ // Set it config now
+ $this->getConfigInstance()->setConfigEntry('node_id', (string) $nodeId);
+ }
+
+ /**
+ * Getter for node id
+ *
+ * @return $nodeId Current node id
+ */
+ public final function getNodeId () {
+ // Get it from config
+ return $this->getConfigInstance()->getConfigEntry('node_id');
+ }
+
+ /**
+ * Setter for session id
+ *
+ * @param $sessionId Our new session id
+ * @return void
+ */
+ protected final function setSessionId ($sessionId) {
+ $this->getConfigInstance()->setConfigEntry('session_id', (string) $sessionId);
+ }
+
+ /**
+ * Getter for session id
+ *
+ * @return $sessionId Current session id
+ */
+ public final function getSessionId () {
+ return $this->getConfigInstance()->getConfigEntry('session_id');
+ }
+
/**
* Constructs a callable method name from given socket error code. If the
* method is not found, a generic one is used.
* @throws UnsupportedSocketErrorHandlerException If the error handler is not implemented
*/
protected function getSocketErrorHandlerFromCode ($errorCode) {
- // Set NULL, so everyone is forced to implement socket error handlers
- $handlerName = NULL;
-
- // Temporary create a possible name from translated error code
+ // Create a name from translated error code
$handlerName = 'socketError' . $this->convertToClassName($this->translateSocketErrorCodeToName($errorCode)) . 'Handler';
// Is the call-back method there?
assert(count($chunkSplits) == 3);
// Validate final chunk
- if (substr($chunkSplits[2], 0, strlen(PackageFragmenter::END_OF_PACKAGE_IDENTIFIER)) != PackageFragmenter::END_OF_PACKAGE_IDENTIFIER) {
+ if (substr($chunkSplits[ChunkHandler::CHUNK_SPLITS_INDEX_RAW_DATA], 0, strlen(PackageFragmenter::END_OF_PACKAGE_IDENTIFIER)) != PackageFragmenter::END_OF_PACKAGE_IDENTIFIER) {
// Not fine
$isValid = false;
- } elseif (substr_count($chunkSplits[2], PackageFragmenter::CHUNK_HASH_SEPARATOR) != 1) {
+ } elseif (substr_count($chunkSplits[ChunkHandler::CHUNK_SPLITS_INDEX_RAW_DATA], PackageFragmenter::CHUNK_HASH_SEPARATOR) != 1) {
// CHUNK_HASH_SEPARATOR shall only be found once
$isValid = false;
}
// Get a visitor instance
$visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_socket_visitor_class');
+ // Debug output
+ $this->debugOutput('HUB-SYSTEM:' . $this->__toString() . ': visitorInstance=' . $visitorInstance->__toString());
+
// Call the visitor
$this->accept($visitorInstance);
}
// Get a visitor instance
$visitorInstance = ObjectFactory::createObjectByConfiguredName('half_shutdown_socket_visitor_class');
+ // Debug output
+ $this->debugOutput('HUB-SYSTEM:' . $this->__toString() . ': visitorInstance=' . $visitorInstance->__toString());
+
// Call the visitor
$this->accept($visitorInstance);
}