Compare commits

...
Author SHA1 Message Date
Simon Désaulniers eafb934e85 bump version to 1.2.1 2016-10-28 18:49:09 -04:00
Adrien Béraud c3d3da20f6 Merge pull request #146 from sim590/permanent-put-enhancement
dht: make reannounce margin bigger, safer
2016-10-28 16:24:07 -04:00
Adrien Béraud 6036ccdbaa dht: try inserting new nodes smarter (#150)
Attempt closest search and nearby searches
until we are too far instead of trying every
search.
2016-10-28 15:46:27 -04:00
Simon Désaulniers 9404a4d069 dht: make reannounce margin bigger, safer
Reannouncing margin going from 5 seconds to 10 seconds.
2016-10-28 15:24:09 -04:00
4 changed files with 25 additions and 9 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
cmake_minimum_required (VERSION 2.8.6)
project (opendht)
set (opendht_VERSION_MAJOR 1)
set (opendht_VERSION_MINOR 2.0)
set (opendht_VERSION_MINOR 2.1)
set (opendht_VERSION ${opendht_VERSION_MAJOR}.${opendht_VERSION_MINOR})
set (PACKAGE_VERSION ${opendht_VERSION})
set (VERSION "${opendht_VERSION}")
+1 -1
View File
@@ -1,7 +1,7 @@
dnl define macros
m4_define([opendht_major_version], 1)
m4_define([opendht_minor_version], 2)
m4_define([opendht_patch_version], 0)
m4_define([opendht_patch_version], 1)
m4_define([opendht_version],
[opendht_major_version.opendht_minor_version.opendht_patch_version])
+1 -1
View File
@@ -344,7 +344,7 @@ private:
/* Timeout for listen */
static constexpr std::chrono::seconds LISTEN_EXPIRE_TIME {30};
static constexpr std::chrono::seconds REANNOUNCE_MARGIN {5};
static constexpr std::chrono::seconds REANNOUNCE_MARGIN {10};
static constexpr size_t TOKEN_SIZE {64};
+22 -6
View File
@@ -815,15 +815,31 @@ Dht::trySearchInsert(const std::shared_ptr<Node>& node)
const auto& now = scheduler.time();
if (not node) return false;
bool inserted = false;
auto family = node->getFamily();
auto& srs = family == AF_INET ? searches4 : searches6;
for (auto& srp : srs) {
auto& s = *srp.second;
auto& srs = searches(node->getFamily());
auto closest = srs.lower_bound(node->id);
bool inserted {false};
// insert forward
auto it = closest;
while (it != srs.end()) {
auto& s = *it->second;
if (s.insertNode(node, now)) {
inserted = true;
scheduler.edit(s.nextSearchStep, s.getNextStepTime(now));
}
} else
break;
++it;
}
// insert backward
it = closest;
while (it != srs.begin()) {
--it;
auto& s = *it->second;
if (s.insertNode(node, now)) {
inserted = true;
scheduler.edit(s.nextSearchStep, s.getNextStepTime(now));
} else
break;
}
return inserted;
}