dht: remove unnecessary return value

This commit is contained in:
Simon Désaulniers committed 2016-09-07 16:15:06 -04:00
1 parent fd4cce4883
commit d60672e8ba
2 files changed
+9 -11

No files matched your search

+4 -4
View File
@@ -113,12 +113,12 @@ public:
* The node is not pinged, so this should be
* used to bootstrap efficiently from previously known nodes.
*/
bool insertNode(const InfoHash& id, const sockaddr*, socklen_t);
bool insertNode(const NodeExport& n) {
return insertNode(n.id, reinterpret_cast<const sockaddr*>(&n.ss), n.sslen);
void insertNode(const InfoHash& id, const sockaddr*, socklen_t);
void insertNode(const NodeExport& n) {
insertNode(n.id, reinterpret_cast<const sockaddr*>(&n.ss), n.sslen);
}
int pingNode(const sockaddr*, socklen_t);
void pingNode(const sockaddr*, socklen_t);
time_point periodic(const uint8_t *buf, size_t buflen, const sockaddr *from, socklen_t fromlen);
+5 -7
View File
@@ -2844,30 +2844,28 @@ Dht::exportNodes()
return nodes;
}
bool
void
Dht::insertNode(const InfoHash& id, const sockaddr* sa, socklen_t salen)
{
if (sa->sa_family != AF_INET && sa->sa_family != AF_INET6)
return false;
return;
scheduler.syncTime();
auto n = network_engine.insertNode(id, sa, salen);
return !!n;
network_engine.insertNode(id, sa, salen);
}
int
void
Dht::pingNode(const sockaddr* sa, socklen_t salen)
{
scheduler.syncTime();
DHT_LOG.DEBUG("Sending ping to %s", print_addr(sa, salen).c_str());
auto& count = sa->sa_family == AF_INET ? pending_pings4 : pending_pings6;
count++;
network_engine.sendPing(sa, salen, [&](const Request&, NetworkEngine::RequestAnswer&&){
network_engine.sendPing(sa, salen, [&](const Request&, NetworkEngine::RequestAnswer&&) {
count--;
}, [&](const Request&, bool last){
if (last)
count--;
});
return -1;
}
void