From fab88735d3d4f2b3a979c6a6a5dd3cd8eb5f733c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 22 Feb 2013 03:49:02 +0000 Subject: [PATCH] Also check for node id to have full match, this requires you to remove all *.serialized in db/node_data and db/node_dht/ --- .../node/class_NodeDistributedHashTableDatabaseWrapper.php | 3 ++- .../hub/main/package/fragmenter/class_PackageFragmenter.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php index 45208a22e..dc494d5bc 100644 --- a/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php @@ -117,9 +117,10 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem // Make sure both is valid assert(($ipPort[0] !== 'invalid') && ($ipPort[1] !== 'invalid')); - // Add ip:port as criteria + // Add ip:port/node id as criteria $searchInstance->addCriteria(self::DB_COLUMN_EXTERNAL_IP, $ipPort[0]); $searchInstance->addCriteria(self::DB_COLUMN_LISTEN_PORT, $ipPort[1]); + $searchInstance->addCriteria(self::DB_COLUMN_NODE_ID , $nodeInstance->getNodeId()); $searchInstance->setLimit(1); // Query database and get a result instance back diff --git a/application/hub/main/package/fragmenter/class_PackageFragmenter.php b/application/hub/main/package/fragmenter/class_PackageFragmenter.php index 2debe34fa..3a9adc3ed 100644 --- a/application/hub/main/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/main/package/fragmenter/class_PackageFragmenter.php @@ -366,7 +366,8 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera ); // Make sure the chunk is not larger than a TCP package can hold - assert(strlen($rawData) <= NetworkPackage::TCP_PACKAGE_SIZE); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(__METHOD__ . ': assert: ' . strlen($rawData) . '/' . NetworkPackage::TCP_PACKAGE_SIZE . ' ...'); + // @TODO This assert broke packages where the hash chunk was very large: assert(strlen($rawData) <= NetworkPackage::TCP_PACKAGE_SIZE); // Add it to the array if ($prepend === true) { @@ -519,7 +520,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera */ public function resetSerialNumber () { // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('FRAGMENTER: Resetting serial number, previous=' . $this->serialNumber); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('FRAGMENTER: Resetting serial number, previous=' . $this->serialNumber); // Reset serial number $this->serialNumber = 0; -- 2.39.5