MCPcopy Create free account
hub / github.com/amule-project/amule / PackPacket

Method PackPacket

src/Packet.cpp:247–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245
246
247void CPacket::PackPacket()
248{
249 wxASSERT(!m_bSplitted);
250
251 uLongf newsize = size + 300;
252 uint8_t* output = new uint8_t[newsize];
253
254 uint16 result = compress2(output, &newsize, pBuffer, size, Z_BEST_COMPRESSION);
255
256 if (result != Z_OK || size <= newsize) {
257 delete[] output;
258 return;
259 }
260
261 if (prot == OP_KADEMLIAHEADER) {
262 prot = OP_KADEMLIAPACKEDPROT;
263 } else {
264 prot = OP_PACKEDPROT;
265 }
266
267 memcpy(pBuffer, output, newsize);
268 delete[] output;
269 m_bPacked = true;
270
271 size = newsize;
272}
273
274
275bool CPacket::UnPackPacket(uint32 uMaxDecompressedSize) {

Callers 4

CreateSrcInfoPacketMethod · 0.80
SendListToServerMethod · 0.80
CreateSrcInfoPacketMethod · 0.80
SendPacketMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected