summaryrefslogtreecommitdiff
path: root/src/libutp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutp')
-rw-r--r--src/libutp/utp_internal.cpp2
-rw-r--r--src/libutp/utp_internal.h7
2 files changed, 5 insertions, 4 deletions
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;
}