Browse Source

compress longer RouterInfo

pull/1525/head
orignal 5 years ago
parent
commit
ead89c767a
  1. 9
      libi2pd/I2NPProtocol.cpp

9
libi2pd/I2NPProtocol.cpp

@ -257,7 +257,14 @@ namespace i2p
uint8_t * sizePtr = buf; uint8_t * sizePtr = buf;
buf += 2; buf += 2;
m->len += (buf - payload); // payload size m->len += (buf - payload); // payload size
size_t size = i2p::data::GzipNoCompression (router->GetBuffer (), router->GetBufferLen (), buf, m->maxLen -m->len); size_t size = 0;
if (router->GetBufferLen () + (buf - payload) <= 940) // fits one tunnel message
size = i2p::data::GzipNoCompression (router->GetBuffer (), router->GetBufferLen (), buf, m->maxLen -m->len);
else
{
i2p::data::GzipDeflator deflator;
size = deflator.Deflate (router->GetBuffer (), router->GetBufferLen (), buf, m->maxLen -m->len);
}
if (size) if (size)
{ {
htobe16buf (sizePtr, size); // size htobe16buf (sizePtr, size); // size

Loading…
Cancel
Save