mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
This patch partially rebuilds the data block sender/receiver. The receiver leaks memory if the sender sends a bogus LZ4 packet, it would allocate memory to copy the encoded data into, from which it would decode it to the scratch buffer, but it would never deallocate this temporary buffer is the LZ4 decoder failed. This has been fixed. The second reason to rebuild these was to look into potential compression optimization. The data block rebuild now also features the latest LZ4 codec.
33 lines
908 B
C++
33 lines
908 B
C++
#ifndef IDATABLOCK_H
|
|
#define IDATABLOCK_H
|
|
|
|
// the maximum size of each data block fragment
|
|
#define MAX_DATABLOCK_FRAGMENT_SIZE 1024
|
|
|
|
// the maximum amount of fragments per data block
|
|
#define MAX_DATABLOCK_FRAGMENTS 768
|
|
|
|
#define MAX_DATABLOCK_DEBUG_NAME 64
|
|
|
|
abstract_class NetDataBlockSender
|
|
{
|
|
public:
|
|
virtual ~NetDataBlockSender() {};
|
|
virtual void SendDataBlock(const short transferId, const int transferSize,
|
|
const short transferNr, const short blockNr, const uint8_t* const blockData, const int blockSize) = 0;
|
|
virtual float GetResendRate() const = 0;
|
|
virtual const char* GetReceiverName() const = 0;
|
|
};
|
|
|
|
abstract_class NetDataBlockReceiver
|
|
{
|
|
public:
|
|
virtual ~NetDataBlockReceiver() {};
|
|
// Called when cvar 'net_debugDataBlockReceiver' is set;
|
|
// currently a nullsub in the engine.
|
|
virtual void DebugDataBlockReceiver() {};
|
|
virtual void AcknowledgeTransmission() = 0;
|
|
};
|
|
|
|
#endif // IDATABLOCK_H
|