|
|
@ -218,7 +218,6 @@ vector<shared_ptr<NodeEntry>> NodeTable::nearestNodeEntries(NodeId _target) |
|
|
|
Guard l(x_state); |
|
|
|
for (auto n: m_state[head].nodes) |
|
|
|
if (auto p = n.lock()) |
|
|
|
if (!!p->endpoint && p->endpoint.isAllowed()) |
|
|
|
{ |
|
|
|
if (count < s_bucketSize) |
|
|
|
found[distance(_target, p->id)].push_back(p); |
|
|
@ -229,7 +228,6 @@ vector<shared_ptr<NodeEntry>> NodeTable::nearestNodeEntries(NodeId _target) |
|
|
|
if (count < s_bucketSize && tail) |
|
|
|
for (auto n: m_state[tail].nodes) |
|
|
|
if (auto p = n.lock()) |
|
|
|
if (!!p->endpoint && p->endpoint.isAllowed()) |
|
|
|
{ |
|
|
|
if (count < s_bucketSize) |
|
|
|
found[distance(_target, p->id)].push_back(p); |
|
|
@ -247,7 +245,6 @@ vector<shared_ptr<NodeEntry>> NodeTable::nearestNodeEntries(NodeId _target) |
|
|
|
Guard l(x_state); |
|
|
|
for (auto n: m_state[head].nodes) |
|
|
|
if (auto p = n.lock()) |
|
|
|
if (!!p->endpoint && p->endpoint.isAllowed()) |
|
|
|
{ |
|
|
|
if (count < s_bucketSize) |
|
|
|
found[distance(_target, p->id)].push_back(p); |
|
|
@ -262,7 +259,6 @@ vector<shared_ptr<NodeEntry>> NodeTable::nearestNodeEntries(NodeId _target) |
|
|
|
Guard l(x_state); |
|
|
|
for (auto n: m_state[tail].nodes) |
|
|
|
if (auto p = n.lock()) |
|
|
|
if (!!p->endpoint && p->endpoint.isAllowed()) |
|
|
|
{ |
|
|
|
if (count < s_bucketSize) |
|
|
|
found[distance(_target, p->id)].push_back(p); |
|
|
@ -275,7 +271,7 @@ vector<shared_ptr<NodeEntry>> NodeTable::nearestNodeEntries(NodeId _target) |
|
|
|
vector<shared_ptr<NodeEntry>> ret; |
|
|
|
for (auto& nodes: found) |
|
|
|
for (auto n: nodes.second) |
|
|
|
if (ret.size() < s_bucketSize && n->endpoint.isAllowed()) |
|
|
|
if (ret.size() < s_bucketSize && !!n->endpoint && n->endpoint.isAllowed()) |
|
|
|
ret.push_back(n); |
|
|
|
return move(ret); |
|
|
|
} |
|
|
|