From c47870421f189eb98fc66e912693d73fbd8477ee Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 16 Oct 2018 00:37:21 +0200 Subject: Reuse peer connection if subscribed to same key --- include/sibs/IpAddress.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/sibs/IpAddress.hpp') diff --git a/include/sibs/IpAddress.hpp b/include/sibs/IpAddress.hpp index c3b43c4..4403e83 100644 --- a/include/sibs/IpAddress.hpp +++ b/include/sibs/IpAddress.hpp @@ -2,6 +2,7 @@ #include #include +#include #ifndef WIN32 #include #include @@ -32,7 +33,19 @@ namespace sibs unsigned short getPort() const; bool operator == (const Ipv4 &other) const; + bool operator != (const Ipv4 &other) const; struct sockaddr_in address; }; + + struct Ipv4Hasher + { + size_t operator()(const Ipv4 &address) const + { + return address.address.sin_addr.s_addr ^ address.address.sin_port; + } + }; + + template + using Ipv4Map = std::unordered_map; } -- cgit v1.2.3