X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fnet%2FChunkTransmitter.hpp;fp=src%2Fnet%2FChunkTransmitter.hpp;h=0000000000000000000000000000000000000000;hb=8ae45b6555d55f301f83daf8c1337d332d8305ab;hp=44f6bd87106a009a630bb6af990d90b56ab0b0a0;hpb=7fd76e64de47f564117b9e6f73f1482d93842108;p=blank.git diff --git a/src/net/ChunkTransmitter.hpp b/src/net/ChunkTransmitter.hpp deleted file mode 100644 index 44f6bd8..0000000 --- a/src/net/ChunkTransmitter.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef BLANK_NET_CHUNKTRANSMITTER_HPP_ -#define BLANK_NET_CHUNKTRANSMITTER_HPP_ - -#include -#include -#include - - -namespace blank { - -class Chunk; -class ClientConnection; - -class ChunkTransmitter { - -public: - explicit ChunkTransmitter(ClientConnection &); - ~ChunkTransmitter(); - - /// Returns true if not transmitting or waiting on acks, so - /// the next chunk may be queued without schmutzing up anything. - bool Idle() const noexcept; - - /// Returns true if a transmission is still going on, - /// meaning there's at least one packet that needs to - /// be sent. - bool Transmitting() const noexcept; - /// Send the next packet of the current chunk (if any). - void Transmit(); - - /// Returns true if there's one or more packets which - /// still have to be ack'd by the remote. - bool Waiting() const noexcept; - /// Mark packet with given sequence number as ack'd. - /// If all packets for the current chunk have been ack'd - /// the transmission is considered complete. - void Ack(std::uint16_t); - /// Mark packet with given sequence number as lost. - /// Its part of the chunk data should be resent. - void Nack(std::uint16_t); - - /// Cancel the current transmission. - void Abort(); - /// Start transmitting given chunk. - /// If there's a chunk already in transmission it will be - /// cancelled. - void Send(Chunk &); - -private: - void SendBegin(); - void SendData(std::size_t); - void Release(); - -private: - ClientConnection &conn; - Chunk *current; - std::size_t buffer_size; - std::unique_ptr buffer; - std::size_t buffer_len; - std::size_t packet_len; - std::size_t cursor; - std::size_t num_packets; - int begin_packet; - std::vector data_packets; - int confirm_wait; - std::uint32_t trans_id; - bool compressed; - -}; - -} - -#endif