Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cancel request when receiving token error
- Loading branch information
Showing
3 changed files
with
29 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2524,17 +2524,15 @@ Dht::pingNode(const sockaddr *sa, socklen_t salen) | |
} | ||
|
||
void | ||
Dht::onError(std::shared_ptr<NetworkEngine::Request> status, DhtProtocolException e) { | ||
Dht::onError(std::shared_ptr<NetworkEngine::Request> req, DhtProtocolException e) { | ||
if (e.getCode() == DhtProtocolException::UNAUTHORIZED) { | ||
//TODO | ||
//auto esr = searches.find(status); | ||
//if (esr == searches.end()) return; | ||
network_engine.cancelRequest(req); | ||
unsigned cleared = 0; | ||
for (auto& srp : status->node->ss.ss_family == AF_INET ? searches4 : searches6) { | ||
for (auto& srp : req->node->ss.ss_family == AF_INET ? searches4 : searches6) { | ||
auto& sr = srp.second; | ||
for (auto& n : sr->nodes) { | ||
if (n.node != status->node) continue; | ||
n.getStatus = {}; | ||
if (n.node != req->node) continue; | ||
network_engine.cancelRequest(n.getStatus); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
aberaud
Author
Member
|
||
n.last_get_reply = time_point::min(); | ||
cleared++; | ||
if (searchSendGetValues(sr)) | ||
|
@@ -2543,7 +2541,7 @@ Dht::onError(std::shared_ptr<NetworkEngine::Request> status, DhtProtocolExceptio | |
} | ||
} | ||
DHT_LOG.WARN("[node %s %s] token flush (%d searches affected)", | ||
status->node->id.toString().c_str(), print_addr((sockaddr*)&status->node->ss, status->node->sslen).c_str(), cleared); | ||
req->node->id.toString().c_str(), print_addr((sockaddr*)&req->node->ss, req->node->sslen).c_str(), cleared); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@aberaud: is line 2535 meant to cancel a possible diffrent request than
req
, in case a new request would have been issued before receiving an error forreq
? Since I'm working on queries and now keeping track of multiple requests for a searchnode, would you say the desired behavior here would be to cancel allget
requests associated to thisSearchNode
?