From f27e1b52f46c0ea207a195af6ee1940bc1bd8ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=20C=C5=93ur?= Date: Fri, 30 Sep 2022 23:04:46 +0800 Subject: [PATCH] Fix TR_ASSERT equality (#3852) * Fix TR_ASSERT equality * Further workaround to the assertions from tr-dht * Update libtransmission/tr-dht.cc Co-authored-by: Charles Kerr --- libtransmission/tr-dht.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libtransmission/tr-dht.cc b/libtransmission/tr-dht.cc index 6606b7431..7482dbc94 100644 --- a/libtransmission/tr-dht.cc +++ b/libtransmission/tr-dht.cc @@ -386,8 +386,6 @@ static void bootstrapStart(tr_session* const session, std::vector nodes break; } } - TR_ASSERT(walk4 = std::data(nodes4) + std::size(nodes4)); - TR_ASSERT(walk6 = std::data(nodes6) + std::size(nodes6)); if (!isBootstrapDone(session, 0)) { @@ -759,7 +757,10 @@ void tr_dhtUpkeep(tr_session* session) void tr_dhtCallback(tr_session* session, unsigned char* buf, int buflen, struct sockaddr* from, socklen_t fromlen) { - TR_ASSERT(tr_dhtEnabled(session)); + if (!tr_dhtEnabled(session)) + { + return; + } time_t tosleep = 0; int const rc = locked_dht::periodic(buf, buflen, from, fromlen, &tosleep, callback, nullptr);