summaryrefslogtreecommitdiff
path: root/src/network.h
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-08-13 19:01:48 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-08-16 21:49:39 +0200
commit2ed8103ff1c0fca7372b3c3888f590ba41c525e6 (patch)
tree103834746f4b64c7dbaf4a237447108cdf44c8d9 /src/network.h
parent7420a170928da75cb860e3fc8804416babdeec8c (diff)
Connection class for network protocol
Diffstat (limited to 'src/network.h')
-rw-r--r--src/network.h6
1 files changed, 4 insertions, 2 deletions
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<monostate,
shared_ptr<struct WaitingRef>,
@@ -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<LocalState> &);
@@ -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;