summaryrefslogtreecommitdiff
path: root/src/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/network.h')
-rw-r--r--src/network.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/network.h b/src/network.h
index 4c23b47..8ea8b6c 100644
--- a/src/network.h
+++ b/src/network.h
@@ -54,6 +54,8 @@ struct Server::Peer
PartialStorage partStorage;
vector<tuple<UUID, shared_ptr<WaitingRef>>> serviceQueue {};
+ vector< shared_ptr< NetworkProtocol::InStream >> dataResponseStreams {};
+ vector< Digest > requestedData {};
shared_ptr<erebos::Peer::Priv> lpeer = nullptr;
@@ -61,6 +63,7 @@ struct Server::Peer
void updateChannel(ReplyBuilder &);
void finalizeChannel(ReplyBuilder &, unique_ptr<Channel>);
void updateService(ReplyBuilder &, vector<tuple<shared_ptr<erebos::Peer::Priv>, Service &, Ref>> & readyServices);
+ void checkDataResponseStreams( ReplyBuilder & );
};
struct Peer::Priv : enable_shared_from_this<Peer::Priv>
@@ -133,4 +136,30 @@ struct Server::Priv
vector<unique_ptr<Service>> services;
};
+class ReplyBuilder
+{
+public:
+ using Header = NetworkProtocol::Header;
+
+ void header( Header::Item && );
+ void body( const Ref & );
+
+ const vector< Header::Item > & header() const { return mheader; }
+ vector< Object > body() const;
+
+private:
+ vector< Header::Item > mheader;
+ vector< Ref > mbody;
+};
+
+struct WaitingRef
+{
+ const Storage storage;
+ const PartialRef ref;
+ vector< Digest > missing;
+
+ optional< Ref > check();
+ optional< Ref > check( ReplyBuilder &, const vector< Digest > &);
+};
+
}