mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
use delivery type local if destination is not secified
This commit is contained in:
parent
3ef8b3dcbb
commit
c3aa6b9cda
|
@ -739,8 +739,11 @@ namespace garlic
|
||||||
uint64_t ts = i2p::util::GetMillisecondsSinceEpoch ();
|
uint64_t ts = i2p::util::GetMillisecondsSinceEpoch ();
|
||||||
size_t payloadLen = 0;
|
size_t payloadLen = 0;
|
||||||
if (first) payloadLen += 7;// datatime
|
if (first) payloadLen += 7;// datatime
|
||||||
if (msg && m_Destination)
|
if (msg)
|
||||||
payloadLen += msg->GetPayloadLength () + 13 + 32;
|
{
|
||||||
|
payloadLen += msg->GetPayloadLength () + 13;
|
||||||
|
if (m_Destination) payloadLen += 32;
|
||||||
|
}
|
||||||
auto leaseSet = (GetLeaseSetUpdateStatus () == eLeaseSetUpdated ||
|
auto leaseSet = (GetLeaseSetUpdateStatus () == eLeaseSetUpdated ||
|
||||||
(GetLeaseSetUpdateStatus () == eLeaseSetSubmitted &&
|
(GetLeaseSetUpdateStatus () == eLeaseSetSubmitted &&
|
||||||
ts > GetLeaseSetSubmissionTime () + LEASET_CONFIRMATION_TIMEOUT)) ?
|
ts > GetLeaseSetSubmissionTime () + LEASET_CONFIRMATION_TIMEOUT)) ?
|
||||||
|
@ -816,7 +819,7 @@ namespace garlic
|
||||||
}
|
}
|
||||||
// msg
|
// msg
|
||||||
if (msg && m_Destination)
|
if (msg && m_Destination)
|
||||||
offset += CreateGarlicClove (msg, v.data () + offset, payloadLen - offset, true);
|
offset += CreateGarlicClove (msg, v.data () + offset, payloadLen - offset);
|
||||||
// ack
|
// ack
|
||||||
if (m_AckRequests.size () > 0)
|
if (m_AckRequests.size () > 0)
|
||||||
{
|
{
|
||||||
|
@ -875,16 +878,16 @@ namespace garlic
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ECIESX25519AEADRatchetSession::CreateGarlicClove (std::shared_ptr<const I2NPMessage> msg, uint8_t * buf, size_t len, bool isDestination)
|
size_t ECIESX25519AEADRatchetSession::CreateGarlicClove (std::shared_ptr<const I2NPMessage> msg, uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
if (!msg) return 0;
|
if (!msg) return 0;
|
||||||
uint16_t cloveSize = msg->GetPayloadLength () + 9 + 1;
|
uint16_t cloveSize = msg->GetPayloadLength () + 9 + 1;
|
||||||
if (isDestination) cloveSize += 32;
|
if (m_Destination) cloveSize += 32;
|
||||||
if ((int)len < cloveSize + 3) return 0;
|
if ((int)len < cloveSize + 3) return 0;
|
||||||
buf[0] = eECIESx25519BlkGalicClove; // clove type
|
buf[0] = eECIESx25519BlkGalicClove; // clove type
|
||||||
htobe16buf (buf + 1, cloveSize); // size
|
htobe16buf (buf + 1, cloveSize); // size
|
||||||
buf += 3;
|
buf += 3;
|
||||||
if (isDestination)
|
if (m_Destination)
|
||||||
{
|
{
|
||||||
*buf = (eGarlicDeliveryTypeDestination << 5);
|
*buf = (eGarlicDeliveryTypeDestination << 5);
|
||||||
memcpy (buf + 1, *m_Destination, 32); buf += 32;
|
memcpy (buf + 1, *m_Destination, 32); buf += 32;
|
||||||
|
|
|
@ -171,7 +171,7 @@ namespace garlic
|
||||||
bool NewExistingSessionMessage (const uint8_t * payload, size_t len, uint8_t * out, size_t outLen);
|
bool NewExistingSessionMessage (const uint8_t * payload, size_t len, uint8_t * out, size_t outLen);
|
||||||
|
|
||||||
std::vector<uint8_t> CreatePayload (std::shared_ptr<const I2NPMessage> msg, bool first);
|
std::vector<uint8_t> CreatePayload (std::shared_ptr<const I2NPMessage> msg, bool first);
|
||||||
size_t CreateGarlicClove (std::shared_ptr<const I2NPMessage> msg, uint8_t * buf, size_t len, bool isDestination = false);
|
size_t CreateGarlicClove (std::shared_ptr<const I2NPMessage> msg, uint8_t * buf, size_t len);
|
||||||
size_t CreateLeaseSetClove (std::shared_ptr<const i2p::data::LocalLeaseSet> ls, uint64_t ts, uint8_t * buf, size_t len);
|
size_t CreateLeaseSetClove (std::shared_ptr<const i2p::data::LocalLeaseSet> ls, uint64_t ts, uint8_t * buf, size_t len);
|
||||||
|
|
||||||
void GenerateMoreReceiveTags (std::shared_ptr<RatchetTagSet> receiveTagset, int numTags);
|
void GenerateMoreReceiveTags (std::shared_ptr<RatchetTagSet> receiveTagset, int numTags);
|
||||||
|
|
Loading…
Reference in a new issue