diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/libutp/utp_internal.cpp | 9 | ||||
| -rw-r--r-- | src/libutp/utp_internal.h | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/libutp/utp_internal.cpp b/src/libutp/utp_internal.cpp index 93117e97..90d281a4 100644 --- a/src/libutp/utp_internal.cpp +++ b/src/libutp/utp_internal.cpp @@ -2867,7 +2867,8 @@ int utp_process_udp(utp_context *ctx, const byte *buffer, size_t len, const stru const byte flags = pf1->type(); if (flags == ST_RESET) { - if (auto* conn = LookupAdjacent(ctx, addr, id); conn != nullptr) { + auto* conn = LookupAdjacent(ctx, addr, id); + if (conn != nullptr) { #if UTP_DEBUG_LOGGING ctx->log(UTP_LOG_DEBUG, NULL, "recv RST for existing connection"); #endif @@ -2890,10 +2891,11 @@ int utp_process_udp(utp_context *ctx, const byte *buffer, size_t len, const stru } else if (flags != ST_SYN) { UTPSocket* conn = NULL; + UTPSocket* lookup; if (ctx->last_utp_socket && ctx->last_utp_socket->addr == addr && ctx->last_utp_socket->conn_id_recv == id) { conn = ctx->last_utp_socket; - } else if (auto* lookup = ctx->utp_sockets.lookup(UTPSocketKey{ addr, id }); lookup != nullptr) { + } else if (lookup = ctx->utp_sockets.lookup(UTPSocketKey{ addr, id }); lookup != nullptr) { conn = ctx->last_utp_socket = lookup; } @@ -3047,7 +3049,8 @@ static UTPSocket* parse_icmp_payload(utp_context *ctx, const byte *buffer, size_ return NULL; } - if (auto* const conn = LookupAdjacent(ctx, addr, id); conn != nullptr) + auto* const conn = LookupAdjacent(ctx, addr, id); + if (conn != nullptr) return conn; #if UTP_DEBUG_LOGGING diff --git a/src/libutp/utp_internal.h b/src/libutp/utp_internal.h index 2cc7a9ff..33500f98 100644 --- a/src/libutp/utp_internal.h +++ b/src/libutp/utp_internal.h @@ -127,11 +127,11 @@ class UTPSocketHT { using Map = std::unordered_map<Key, V>; public: - [[nodiscard]] auto contains(Key const& key) const { + [[nodiscard]] auto contains(Key const& key)->bool const { return map_.count(key) != 0U; } - [[nodiscard]] auto size() const { + [[nodiscard]] auto size()->bool const { return map_.size(); } |
