Some more updates
This commit is contained in:
parent
2ffa12489d
commit
62292af022
@ -10,16 +10,17 @@ namespace ts {
|
|||||||
size_t qlz_compressed_size(const void* payload, size_t payload_length);
|
size_t qlz_compressed_size(const void* payload, size_t payload_length);
|
||||||
bool qlz_compress_payload(const void* payload, size_t payload_length, void* buffer, size_t* buffer_length);
|
bool qlz_compress_payload(const void* payload, size_t payload_length, void* buffer, size_t* buffer_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace connection {
|
namespace connection {
|
||||||
class CompressionHandler {
|
class CompressionHandler {
|
||||||
public:
|
public:
|
||||||
CompressionHandler();
|
CompressionHandler();
|
||||||
virtual ~CompressionHandler();
|
~CompressionHandler();
|
||||||
|
|
||||||
bool progressPacketOut(protocol::BasicPacket*, std::string&);
|
bool progressPacketOut(protocol::BasicPacket*, std::string&);
|
||||||
bool progressPacketIn(protocol::BasicPacket*, std::string&);
|
bool progressPacketIn(protocol::BasicPacket*, std::string&);
|
||||||
|
|
||||||
size_t max_packet_size = 16 * 1024;
|
size_t max_packet_size{16 * 1024};
|
||||||
private:
|
private:
|
||||||
bool compress(protocol::BasicPacket*, std::string &error);
|
bool compress(protocol::BasicPacket*, std::string &error);
|
||||||
bool decompress(protocol::BasicPacket*, std::string &error);
|
bool decompress(protocol::BasicPacket*, std::string &error);
|
||||||
|
@ -86,19 +86,19 @@ namespace ts {
|
|||||||
public:
|
public:
|
||||||
PacketIdManager() : data(new PacketIdManagerData){}
|
PacketIdManager() : data(new PacketIdManagerData){}
|
||||||
~PacketIdManager() = default;
|
~PacketIdManager() = default;
|
||||||
PacketIdManager(const PacketIdManager& ref) : data(ref.data) {}
|
PacketIdManager(const PacketIdManager& ref) = default;
|
||||||
PacketIdManager(PacketIdManager&& ref) : data(std::move(ref.data)) {}
|
PacketIdManager(PacketIdManager&& ref) = default;
|
||||||
|
|
||||||
uint16_t nextPacketId(const PacketTypeInfo &type){
|
uint16_t nextPacketId(const PacketTypeInfo &type){
|
||||||
return static_cast<uint16_t>(data->packetCounter[type.type()]++ & 0xFFFF);
|
return static_cast<uint16_t>(data->packetCounter[type.type()]++ & 0xFFFFU);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t currentPacketId(const PacketTypeInfo &type){
|
uint16_t currentPacketId(const PacketTypeInfo &type){
|
||||||
return static_cast<uint16_t>(data->packetCounter[type.type()] & 0xFFFF);
|
return static_cast<uint16_t>(data->packetCounter[type.type()] & 0xFFFFU);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t generationId(const PacketTypeInfo &type){
|
uint16_t generationId(const PacketTypeInfo &type){
|
||||||
return static_cast<uint16_t>((data->packetCounter[type.type()] >> 16) & 0xFFFF);
|
return static_cast<uint16_t>((data->packetCounter[type.type()] >> 16U) & 0xFFFFU);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
Loading…
Reference in New Issue
Block a user