Skip to content
Snippets Groups Projects
Commit 63013bf3 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

SearchNode: prevent copy, check request access

parent 488aa771
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,11 @@ struct Dht::SearchNode { ...@@ -76,6 +76,11 @@ struct Dht::SearchNode {
node is a new candidate for inclusion. */ node is a new candidate for inclusion. */
SearchNode() : node() {} SearchNode() : node() {}
SearchNode(const SearchNode&) = delete;
SearchNode(SearchNode&&) = default;
SearchNode& operator=(const SearchNode&) = delete;
SearchNode& operator=(SearchNode&&) = default;
SearchNode(const Sp<Node>& node) : node(node) {} SearchNode(const Sp<Node>& node) : node(node) {}
~SearchNode() { ~SearchNode() {
if (node) { if (node) {
...@@ -186,6 +191,7 @@ struct Dht::SearchNode { ...@@ -186,6 +191,7 @@ struct Dht::SearchNode {
node->cancelRequest(status.second); node->cancelRequest(status.second);
} }
} }
getStatus.clear();
} }
/** /**
...@@ -227,10 +233,11 @@ struct Dht::SearchNode { ...@@ -227,10 +233,11 @@ struct Dht::SearchNode {
void cancelAnnounce() { void cancelAnnounce() {
for (const auto& status : acked) { for (const auto& status : acked) {
const auto& req = status.second.first; const auto& req = status.second.first;
if (req->pending()) { if (req and req->pending()) {
node->cancelRequest(req); node->cancelRequest(req);
} }
} }
acked.clear();
} }
bool isListening(time_point now) const { bool isListening(time_point now) const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment