mirror of https://github.com/PurpleI2P/i2pd.git
I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
641 B
29 lines
641 B
#include <cryptopp/gzip.h> |
|
#include "Log.h" |
|
#include "Datagram.h" |
|
|
|
namespace i2p |
|
{ |
|
namespace datagram |
|
{ |
|
void DatagramDestination::HandleDataMessagePayload (const uint8_t * buf, size_t len) |
|
{ |
|
// unzip it |
|
CryptoPP::Gunzip decompressor; |
|
decompressor.Put (buf, len); |
|
decompressor.MessageEnd(); |
|
uint8_t uncompressed[MAX_DATAGRAM_SIZE]; |
|
auto uncompressedLen = decompressor.MaxRetrievable (); |
|
if (uncompressedLen <= MAX_DATAGRAM_SIZE) |
|
{ |
|
decompressor.Get (uncompressed, uncompressedLen); |
|
//HandleNextPacket (uncompressed); |
|
} |
|
else |
|
LogPrint ("Received datagram size ", uncompressedLen, " exceeds max size"); |
|
|
|
} |
|
|
|
} |
|
} |
|
|
|
|