mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
always compress SYN packet
This commit is contained in:
parent
b2767304e9
commit
c6e8873d57
@ -855,7 +855,7 @@ namespace stream
|
|||||||
for (const auto& it: packets)
|
for (const auto& it: packets)
|
||||||
{
|
{
|
||||||
auto msg = m_RoutingSession->WrapSingleMessage (m_LocalDestination.CreateDataMessage (
|
auto msg = m_RoutingSession->WrapSingleMessage (m_LocalDestination.CreateDataMessage (
|
||||||
it->GetBuffer (), it->GetLength (), m_Port, !m_RoutingSession->IsRatchets ()));
|
it->GetBuffer (), it->GetLength (), m_Port, !m_RoutingSession->IsRatchets (), it->IsSYN ()));
|
||||||
msgs.push_back (i2p::tunnel::TunnelMessageBlock
|
msgs.push_back (i2p::tunnel::TunnelMessageBlock
|
||||||
{
|
{
|
||||||
i2p::tunnel::eDeliveryTypeTunnel,
|
i2p::tunnel::eDeliveryTypeTunnel,
|
||||||
@ -1085,8 +1085,6 @@ namespace stream
|
|||||||
m_Owner (owner), m_LocalPort (localPort), m_Gzip (gzip),
|
m_Owner (owner), m_LocalPort (localPort), m_Gzip (gzip),
|
||||||
m_PendingIncomingTimer (m_Owner->GetService ())
|
m_PendingIncomingTimer (m_Owner->GetService ())
|
||||||
{
|
{
|
||||||
if (m_Gzip)
|
|
||||||
m_Deflator.reset (new i2p::data::GzipDeflator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamingDestination::~StreamingDestination ()
|
StreamingDestination::~StreamingDestination ()
|
||||||
@ -1365,7 +1363,7 @@ namespace stream
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<I2NPMessage> StreamingDestination::CreateDataMessage (
|
std::shared_ptr<I2NPMessage> StreamingDestination::CreateDataMessage (
|
||||||
const uint8_t * payload, size_t len, uint16_t toPort, bool checksum)
|
const uint8_t * payload, size_t len, uint16_t toPort, bool checksum, bool gzip)
|
||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
auto msg = m_I2NPMsgsPool.AcquireShared ();
|
auto msg = m_I2NPMsgsPool.AcquireShared ();
|
||||||
@ -1373,8 +1371,8 @@ namespace stream
|
|||||||
buf += 4; // reserve for lengthlength
|
buf += 4; // reserve for lengthlength
|
||||||
msg->len += 4;
|
msg->len += 4;
|
||||||
|
|
||||||
if (m_Gzip && m_Deflator)
|
if (m_Gzip || gzip)
|
||||||
size = m_Deflator->Deflate (payload, len, buf, msg->maxLen - msg->len);
|
size = m_Deflator.Deflate (payload, len, buf, msg->maxLen - msg->len);
|
||||||
else
|
else
|
||||||
size = i2p::data::GzipNoCompression (payload, len, buf, msg->maxLen - msg->len);
|
size = i2p::data::GzipNoCompression (payload, len, buf, msg->maxLen - msg->len);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2021, The PurpleI2P Project
|
* Copyright (c) 2013-2022, The PurpleI2P Project
|
||||||
*
|
*
|
||||||
* This file is part of Purple i2pd project and licensed under BSD3
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
@ -284,7 +284,7 @@ namespace stream
|
|||||||
uint16_t GetLocalPort () const { return m_LocalPort; };
|
uint16_t GetLocalPort () const { return m_LocalPort; };
|
||||||
|
|
||||||
void HandleDataMessagePayload (const uint8_t * buf, size_t len);
|
void HandleDataMessagePayload (const uint8_t * buf, size_t len);
|
||||||
std::shared_ptr<I2NPMessage> CreateDataMessage (const uint8_t * payload, size_t len, uint16_t toPort, bool checksum = true);
|
std::shared_ptr<I2NPMessage> CreateDataMessage (const uint8_t * payload, size_t len, uint16_t toPort, bool checksum = true, bool gzip = false);
|
||||||
|
|
||||||
Packet * NewPacket () { return m_PacketsPool.Acquire(); }
|
Packet * NewPacket () { return m_PacketsPool.Acquire(); }
|
||||||
void DeletePacket (Packet * p) { return m_PacketsPool.Release(p); }
|
void DeletePacket (Packet * p) { return m_PacketsPool.Release(p); }
|
||||||
@ -315,7 +315,7 @@ namespace stream
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
i2p::data::GzipInflator m_Inflator;
|
i2p::data::GzipInflator m_Inflator;
|
||||||
std::unique_ptr<i2p::data::GzipDeflator> m_Deflator;
|
i2p::data::GzipDeflator m_Deflator;
|
||||||
|
|
||||||
// for HTTP only
|
// for HTTP only
|
||||||
const decltype(m_Streams)& GetStreams () const { return m_Streams; };
|
const decltype(m_Streams)& GetStreams () const { return m_Streams; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user