]> git.localhorst.tv Git - blank.git/blob - src/net/ChunkReceiver.hpp
more packet introspection from payload
[blank.git] / src / net / ChunkReceiver.hpp
1 #ifndef BLANK_NET_CHUNKRECEIVER_HPP_
2 #define BLANK_NET_CHUNKRECEIVER_HPP_
3
4 #include "Packet.hpp"
5 #include "../app/IntervalTimer.hpp"
6
7 #include <cstdint>
8 #include <list>
9
10
11 namespace blank {
12
13 class ChunkStore;
14 class ChunkTransmission;
15
16 class ChunkReceiver {
17
18 public:
19         explicit ChunkReceiver(ChunkStore &);
20         ~ChunkReceiver();
21
22         void Update(int dt);
23
24         void Handle(const Packet::ChunkBegin &);
25         void Handle(const Packet::ChunkData &);
26
27 private:
28         ChunkTransmission &GetTransmission(std::uint32_t id);
29         void Commit(ChunkTransmission &);
30
31 private:
32         ChunkStore &store;
33         std::list<ChunkTransmission> transmissions;
34         IntervalTimer timer;
35
36 };
37
38 }
39
40 #endif