mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-12 14:26:54 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eafb934e85 | ||
|
|
c3d3da20f6 | ||
|
|
6036ccdbaa | ||
|
|
9404a4d069 |
No files matched your search
+1
-1
@@ -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
@@ -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])
|
||||
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user