From 024dd42e5a002aea47776782c683f137a893af0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= Date: Wed, 11 Oct 2017 17:12:29 +0200 Subject: [PATCH] dht: remove processMessage --- include/opendht/dht.h | 2 -- src/dht.cpp | 29 +++++++---------------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/include/opendht/dht.h b/include/opendht/dht.h index 50215b47..3f70e371 100644 --- a/include/opendht/dht.h +++ b/include/opendht/dht.h @@ -553,8 +553,6 @@ private: bool neighbourhoodMaintenance(RoutingTable&); - void processMessage(const uint8_t *buf, size_t buflen, const SockAddr&); - void onError(Sp node, net::DhtProtocolException e); /* when our address is reported by a distant peer. */ void onReportedAddr(const InfoHash& id, const SockAddr&); diff --git a/src/dht.cpp b/src/dht.cpp index 35a8ff19..cc3e79f5 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -1863,32 +1863,17 @@ Dht::maintainStorage(decltype(store)::value_type& storage, bool force, DoneCallb return announce_per_af; } -void -Dht::processMessage(const uint8_t *buf, size_t buflen, const SockAddr& from) -{ - if (buflen == 0) - return; - - try { - network_engine.processMessage(buf, buflen, from); - } catch (const std::exception& e) { - DHT_LOG.e("Can't parse message from %s: %s", from.toString().c_str(), e.what()); - //auto code = e.getCode(); - //if (code == net::DhtProtocolException::INVALID_TID_SIZE or code == net::DhtProtocolException::WRONG_NODE_INFO_BUF_LEN) { - /* This is really annoying, as it means that we will - time-out all our searches that go through this node. - Kill it. */ - //const auto& id = e.getNodeId(); - //blacklistNode(&id, from, fromlen); - ///} - } -} - time_point Dht::periodic(const uint8_t *buf, size_t buflen, const SockAddr& from) { scheduler.syncTime(); - processMessage(buf, buflen, from); + if (buflen) { + try { + network_engine.processMessage(buf, buflen, from); + } catch (const std::exception& e) { + DHT_LOG.e("Can't parse message from %s: %s", from.toString().c_str(), e.what()); + } + } return scheduler.run(); }