From: Roland Häder Date: Fri, 22 Feb 2013 04:09:19 +0000 (+0000) Subject: Expanded debug lines, renamed 'node_type' to 'node_mode' (which makes your DHT databa... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=27b2dcdf2e5d6974001b4bdf0c436bae27b4b045;p=hub.git Expanded debug lines, renamed 'node_type' to 'node_mode' (which makes your DHT database corrupt) --- diff --git a/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php index dc494d5bc..83c5ec4e4 100644 --- a/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php @@ -32,7 +32,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem const DB_COLUMN_LISTEN_PORT = 'listen_port'; const DB_COLUMN_PRIVATE_KEY = 'private_key'; const DB_COLUMN_PRIVATE_KEY_HASH = 'private_key_hash'; - const DB_COLUMN_NODE_TYPE = 'node_type'; + const DB_COLUMN_NODE_MODE = 'node_mode'; /** * Protected constructor @@ -85,7 +85,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem assert(($ipPort[0] !== 'invalid') && ($ipPort[1] !== 'invalid')); // Add public node data - $dataSetInstance->addCriteria(self::DB_COLUMN_NODE_TYPE , $requestInstance->getRequestElement('mode')); + $dataSetInstance->addCriteria(self::DB_COLUMN_NODE_MODE , $requestInstance->getRequestElement('mode')); $dataSetInstance->addCriteria(self::DB_COLUMN_EXTERNAL_IP , $ipPort[0]); $dataSetInstance->addCriteria(self::DB_COLUMN_LISTEN_PORT , $ipPort[1]); $dataSetInstance->addCriteria(self::DB_COLUMN_NODE_ID , $nodeInstance->getNodeId()); diff --git a/application/hub/main/database/wrapper/node/class_NodeInformationDatabaseWrapper.php b/application/hub/main/database/wrapper/node/class_NodeInformationDatabaseWrapper.php index e9a4c1cd9..bf4997bee 100644 --- a/application/hub/main/database/wrapper/node/class_NodeInformationDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/node/class_NodeInformationDatabaseWrapper.php @@ -31,7 +31,7 @@ class NodeInformationDatabaseWrapper extends BaseDatabaseWrapper implements Node const DB_COLUMN_SESSION_ID = 'session_id'; const DB_COLUMN_PRIVATE_KEY = 'private_key'; const DB_COLUMN_PRIVATE_KEY_HASH = 'private_key_hash'; - const DB_COLUMN_NODE_TYPE = 'node_type'; + const DB_COLUMN_NODE_MODE = 'node_mode'; /** * Protected constructor @@ -72,8 +72,8 @@ class NodeInformationDatabaseWrapper extends BaseDatabaseWrapper implements Node $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_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_TYPE, $nodeInstance->getRequestInstance()->getRequestElement('mode')); + $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_NR , 1); + $searchInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_NODE_MODE, $nodeInstance->getRequestInstance()->getRequestElement('mode')); $searchInstance->setLimit(1); // Get a result back diff --git a/application/hub/main/dht/node/class_NodeDhtFacade.php b/application/hub/main/dht/node/class_NodeDhtFacade.php index 30709fb4c..9c00f7127 100644 --- a/application/hub/main/dht/node/class_NodeDhtFacade.php +++ b/application/hub/main/dht/node/class_NodeDhtFacade.php @@ -224,11 +224,16 @@ class NodeDhtFacade extends BaseDht implements Distributable, Registerable { // Get node list $nodeList = array(); while ($resultInstance->next()) { + // Get current element (it should be an array, and have at least 1 entry) + $current = $resultInstance->current(); + assert(is_array($current)); + assert(count($current) > 0); + // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __LINE__ . ']: current()=' . $resultInstance->current()); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __LINE__ . ']: current(' . count($current) . ')[' . gettype($current) . ']=' . print_r($current, TRUE)); // Add this entry - array_push($nodeList, $resultInstance->current()); + array_push($nodeList, $current); } // END - while // Save last exception