From 244877526f8822bc79728e84cd7534dc0fb65d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20D=C3=A9saulniers?= Date: Thu, 10 Mar 2016 15:11:41 -0500 Subject: [PATCH] fix blacklisting for wrong reason. --- include/opendht/network_engine.h | 5 +++-- src/network_engine.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/opendht/network_engine.h b/include/opendht/network_engine.h index 8d4e457f..757fdd1c 100644 --- a/include/opendht/network_engine.h +++ b/include/opendht/network_engine.h @@ -49,8 +49,9 @@ public: static const constexpr uint16_t NON_AUTHORITATIVE_INFORMATION {203}; /* incomplete request packet. */ static const constexpr uint16_t UNAUTHORIZED {401}; /* wrong tokens. */ // for internal use (custom). - static const constexpr uint16_t INVALID_REPLY_TID {421}; /* id was truncated. */ - static const constexpr uint16_t WRONG_NODE_INFO_BUF_LEN {422}; /* node info length is wrong */ + static const constexpr uint16_t INVALID_TID_SIZE {421}; /* id was truncated. */ + static const constexpr uint16_t UNKNOWN_TID {422}; /* unknown tid */ + static const constexpr uint16_t WRONG_NODE_INFO_BUF_LEN {423}; /* node info length is wrong */ static const std::string GET_NO_INFOHASH; /* received "get" request with no infohash */ static const std::string LISTEN_NO_INFOHASH; /* got "listen" request without infohash */ diff --git a/src/network_engine.cpp b/src/network_engine.cpp index 78fff9c1..111417aa 100644 --- a/src/network_engine.cpp +++ b/src/network_engine.cpp @@ -123,7 +123,7 @@ NetworkEngine::processMessage(const uint8_t *buf, size_t buflen, const sockaddr if (msg.tid.length != 4) { DHT_LOG.ERROR("Broken node truncates transaction ids (len: %d): ", msg.tid.length); DHT_LOG.ERROR.logPrintable(buf, buflen); - throw DhtProtocolException {DhtProtocolException::INVALID_REPLY_TID}; + throw DhtProtocolException {DhtProtocolException::INVALID_TID_SIZE}; } uint16_t ttid = 0; @@ -136,7 +136,7 @@ NetworkEngine::processMessage(const uint8_t *buf, size_t buflen, const sockaddr req = &(*reqp->second); if (not req) - throw DhtProtocolException {DhtProtocolException::INVALID_REPLY_TID, "", msg.id}; + throw DhtProtocolException {DhtProtocolException::UNKNOWN_TID, "Can't find transaction", msg.id}; switch (msg.type) { case MessageType::Error: {