use shared_ptr for garlic messages

This commit is contained in:
orignal 2015-06-21 22:29:50 -04:00
parent 1fc50a59f5
commit 2cbd6e85c6
11 changed files with 36 additions and 39 deletions

View file

@ -617,7 +617,7 @@ namespace stream
{
i2p::tunnel::eDeliveryTypeTunnel,
m_CurrentRemoteLease.tunnelGateway, m_CurrentRemoteLease.tunnelID,
ToSharedI2NPMessage (msg)
msg
});
m_NumSentBytes += it->GetLength ();
}
@ -761,9 +761,9 @@ namespace stream
m_CurrentRemoteLease.endDate = 0;
}
I2NPMessage * Stream::CreateDataMessage (const uint8_t * payload, size_t len)
std::shared_ptr<I2NPMessage> Stream::CreateDataMessage (const uint8_t * payload, size_t len)
{
I2NPMessage * msg = NewI2NPShortMessage ();
auto msg = ToSharedI2NPMessage (NewI2NPShortMessage ());
CryptoPP::Gzip compressor;
if (len <= i2p::stream::COMPRESSION_THRESHOLD_SIZE)
compressor.SetDeflateLevel (CryptoPP::Gzip::MIN_DEFLATE_LEVEL);
@ -780,7 +780,7 @@ namespace stream
htobe16buf (buf + 6, m_Port); // destination port
buf[9] = i2p::client::PROTOCOL_TYPE_STREAMING; // streaming protocol
msg->len += size + 4;
FillI2NPMessageHeader (msg, eI2NPData);
FillI2NPMessageHeader (msg.get (), eI2NPData); // TODO:
return msg;
}