From: Roland Häder Date: Fri, 22 Feb 2013 06:33:05 +0000 (+0000) Subject: true->TRUE, node id included in session id/private key generation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c238ada1ea0d4f8bc8f5be9c5fb01bf7b3412b9f;p=hub.git true->TRUE, node id included in session id/private key generation --- diff --git a/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php b/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php index 839fe894d..a3b08c654 100644 --- a/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/states/class_PeerStateLookupDatabaseWrapper.php @@ -95,7 +95,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look // Is the package valid? if (!isset($packageData[NetworkPackage::PACKAGE_DATA_SENDER])) { // Invalid package found, please report this - $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: packageData=' . print_r($packageData, true)); + $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: packageData=' . print_r($packageData, TRUE)); } // END - if // Get a search criteria instance from package data @@ -108,7 +108,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look } // END - if // Count the query - $entries = $this->doSelectCountByCriteria($searchInstance, array(self::DB_COLUMN_PEER_SESSION_ID => true)); + $entries = $this->doSelectCountByCriteria($searchInstance, array(self::DB_COLUMN_PEER_SESSION_ID => TRUE)); // Is it there? //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: entries=' . $entries); @@ -158,7 +158,7 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look $dataSetInstance->addCriteria(self::DB_COLUMN_PEER_PORT, $peerPort); // "Insert" the data set - $this->queryInsertDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => true)); + $this->queryInsertDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => TRUE)); // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DATABASE-WRAPPER: Peer ' . $packageData[NetworkPackage::PACKAGE_DATA_SENDER] . ' has been registered.'); @@ -197,10 +197,10 @@ class PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper implements Look // Is this a new peer? if ($this->isSenderNewPeer($packageData, $dataSetInstance)) { // "Insert" the data set - $this->queryInsertDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => true)); + $this->queryInsertDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => TRUE)); } else { // Update the data set - $this->queryUpdateDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => true)); + $this->queryUpdateDataSet($dataSetInstance, array(self::DB_COLUMN_PEER_SESSION_ID => TRUE)); } // Debug message diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 4156847bb..224fa481d 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -115,8 +115,8 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { * @todo Make this code more generic and move it to CryptoHelper or */ protected function generateRamdomString ($length) { -// Get an RNG instance -$rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); + // Get an RNG instance + $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); // Generate a pseudo-random string $randomString = $rngInstance->randomString($length) . ':' . $this->getBootIpPort() . ':' . $this->getRequestInstance()->getRequestElement('mode'); @@ -317,6 +317,7 @@ $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); // Search for the node number one which is hard-coded the default $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_NR , 1); $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_MODE, $this->getRequestInstance()->getRequestElement('mode')); + $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_ID , $this->getNodeId()); $searchInstance->setLimit(1); // Remember it for later usage