From ec402bfaa90cdb52276f5ccc2525e799cb4419d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 11 Jan 2020 16:13:40 +0100 Subject: Request missing data from network --- src/network.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/network.h') diff --git a/src/network.h b/src/network.h index af202f6..bb32323 100644 --- a/src/network.h +++ b/src/network.h @@ -10,13 +10,16 @@ #include using std::condition_variable; +using std::monostate; using std::mutex; using std::optional; +using std::shared_ptr; using std::string; using std::thread; using std::unique_ptr; using std::variant; using std::vector; +using std::weak_ptr; namespace chrono = std::chrono; using chrono::steady_clock; @@ -25,13 +28,21 @@ namespace erebos { struct Peer { + Peer(const Peer &) = delete; + Peer & operator=(const Peer &) = delete; + const int sock; const sockaddr_in addr; + variant, + Identity> identity; + Storage tempStorage; PartialStorage partStorage; - void send(const struct TransportHeader &, const vector &); + void send(const struct TransportHeader &, const vector &) const; + void updateIdentity(); }; struct TransportHeader @@ -61,6 +72,16 @@ struct TransportHeader const vector items; }; +struct WaitingRef +{ + const Storage storage; + const PartialRef ref; + const Peer & peer; + vector missing; + + optional check(vector * request = nullptr); +}; + struct Server::Priv { Priv(const Identity & self); @@ -84,6 +105,7 @@ struct Server::Priv vector> peers; vector outgoing; + vector> waiting; int sock; vector bcastAddresses; -- cgit v1.2.3