]> git.mxchange.org Git - hub.git/commitdiff
Expanded debug lines, renamed 'node_type' to 'node_mode' (which makes your DHT databa...
authorRoland Häder <roland@mxchange.org>
Fri, 22 Feb 2013 04:09:19 +0000 (04:09 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 22 Feb 2013 04:09:19 +0000 (04:09 +0000)
application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php
application/hub/main/database/wrapper/node/class_NodeInformationDatabaseWrapper.php
application/hub/main/dht/node/class_NodeDhtFacade.php

index dc494d5bc59fe78c3d84ffbe2417dbd50987f508..83c5ec4e424d67f2c3ebf60ce6de4e4ed2d63d1a 100644 (file)
@@ -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());
index e9a4c1cd9a417d62b79392b9ba3130c111a86bc5..bf4997bee2f604c4bbf29215c026fb698b3b4265 100644 (file)
@@ -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
index 30709fb4c770436e5084a8337cbe32ef866569a8..9c00f7127600d601f11f9e1b91e58ba36062aff1 100644 (file)
@@ -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