mirror of
https://github.com/transmission/transmission.git
synced 2026-02-15 07:26:49 +00:00
feat: split connectable and non-connectable pool (#5801)
This commit is contained in:
@@ -389,12 +389,12 @@ public:
|
||||
std::size_t operator()(tr_socket_address const& socket_address) const noexcept
|
||||
{
|
||||
auto const& [addr, port] = socket_address;
|
||||
return hash_combine(ip_hash(addr), port_hash(port));
|
||||
return hash_combine(ip_hash(addr), PortHasher(port.host()));
|
||||
}
|
||||
|
||||
private:
|
||||
// https://stackoverflow.com/a/27952689/11390656
|
||||
[[nodiscard]] static constexpr std::size_t hash_combine(std::size_t const& a, std::size_t const& b)
|
||||
[[nodiscard]] static constexpr std::size_t hash_combine(std::size_t const a, std::size_t const b)
|
||||
{
|
||||
return a ^ (b + 0x9e3779b9U + (a << 6U) + (a >> 2U));
|
||||
}
|
||||
@@ -414,11 +414,6 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] static std::size_t port_hash(tr_port const& port) noexcept
|
||||
{
|
||||
return PortHasher(port.host());
|
||||
}
|
||||
|
||||
constexpr static std::hash<uint32_t> IPv4Hasher{};
|
||||
constexpr static std::hash<std::string_view> IPv6Hasher{};
|
||||
constexpr static std::hash<uint16_t> PortHasher{};
|
||||
|
||||
Reference in New Issue
Block a user