diff options
| author | Hanjie Wu <wu@x-nagi.com> | 2023-12-16 11:16:43 -0800 |
|---|---|---|
| committer | Hanjie Wu <wu@x-nagi.com> | 2023-12-16 11:16:43 -0800 |
| commit | 2ff458d223762c2004d41a4d04e6a67f0a093fd6 (patch) | |
| tree | 16f754fc3bbb820a3cef8e645158b88cf5eeeb19 | |
| parent | 9204582c0e6a77fcff97b1eb923e908280248eec (diff) | |
bugfix
| -rw-r--r-- | src/UTPexExtensionMessage.cc | 4 | ||||
| -rw-r--r-- | src/libutp/utp_internal.cpp | 2 | ||||
| -rw-r--r-- | src/libutp/utp_internal.h | 7 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/UTPexExtensionMessage.cc b/src/UTPexExtensionMessage.cc index b825b4e5..f266c0f0 100644 --- a/src/UTPexExtensionMessage.cc +++ b/src/UTPexExtensionMessage.cc @@ -92,8 +92,8 @@ std::string UTPexExtensionMessage::getPayload() } namespace { -const char PEX_FLAG_SEEDER = 0x20; -const char PEX_FLAG_UTP = 0x40; +const char PEX_FLAG_SEEDER = 0x02; +const char PEX_FLAG_UTP = 0x04; } // namespace std::pair<std::pair<std::string, std::string>, diff --git a/src/libutp/utp_internal.cpp b/src/libutp/utp_internal.cpp index 8c1b2a86..34281fe9 100644 --- a/src/libutp/utp_internal.cpp +++ b/src/libutp/utp_internal.cpp @@ -3284,7 +3284,7 @@ void utp_check_timeouts(utp_context *ctx) infos.shrink_to_fit(); ctx->utp_sockets.erase_if( - [](auto& item){ + [](const UTPSocketHT::Map::iterator & item){ auto& conn = item->second; conn->check_timeouts(); return conn->state == CS_DESTROY; diff --git a/src/libutp/utp_internal.h b/src/libutp/utp_internal.h index 064ddfa3..1edb1aa2 100644 --- a/src/libutp/utp_internal.h +++ b/src/libutp/utp_internal.h @@ -113,8 +113,6 @@ extern void utp_socket_delete(UTPSocket*); // Container that owns a set of UTPSockets. // The sockets are destroyed when removed from the container. class UTPSocketHT { - using Key = UTPSocketKey; - using Value = UTPSocket; // UTPSocket is an opaque type, so we can't use it for V. // Instead, use a unique_ptr<> which deletes via `utp_socket_delete()`. @@ -123,10 +121,13 @@ class UTPSocketHT { utp_socket_delete(conn); } }; + +public: + using Key = UTPSocketKey; + using Value = UTPSocket; using V = std::unique_ptr<Value, SocketDeleter>; using Map = std::unordered_map<Key, V>; -public: [[nodiscard]] auto contains(Key const& key)->bool const { return map_.count(key) != 0U; } |
