From 2ed8103ff1c0fca7372b3c3888f590ba41c525e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 13 Aug 2023 19:01:48 +0200 Subject: Connection class for network protocol --- src/network.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/network.h') diff --git a/src/network.h b/src/network.h index c242ac5..74231bf 100644 --- a/src/network.h +++ b/src/network.h @@ -44,7 +44,7 @@ struct Server::Peer Peer & operator=(const Peer &) = delete; Priv & server; - const sockaddr_in6 addr; + NetworkProtocol::Connection connection; variant, @@ -157,7 +157,9 @@ struct Server::Priv void doAnnounce(); bool isSelfAddress(const sockaddr_in6 & paddr); + Peer * findPeer(NetworkProtocol::Connection::Id cid) const; Peer & getPeer(const sockaddr_in6 & paddr); + Peer & addPeer(NetworkProtocol::Connection conn); void handlePacket(Peer &, const TransportHeader &, ReplyBuilder &); void handleLocalHeadChange(const Head &); @@ -165,7 +167,7 @@ struct Server::Priv constexpr static uint16_t discoveryPort { 29665 }; constexpr static chrono::seconds announceInterval { 60 }; - mutex dataMutex; + mutable mutex dataMutex; condition_variable announceCondvar; bool finish = false; -- cgit v1.2.3