mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
correct endianess for msgID
This commit is contained in:
parent
aaf386a0ab
commit
f4afaca937
@ -51,12 +51,12 @@ namespace tunnel
|
|||||||
if (diLen + 6 <= m_RemainingSize)
|
if (diLen + 6 <= m_RemainingSize)
|
||||||
{
|
{
|
||||||
// delivery instructions fit
|
// delivery instructions fit
|
||||||
uint32_t msgID = msg->GetHeader ()->msgID;
|
uint32_t msgID = msg->GetHeader ()->msgID; // in network bytes order
|
||||||
size_t size = m_RemainingSize - diLen - 6; // 6 = 4 (msgID) + 2 (size)
|
size_t size = m_RemainingSize - diLen - 6; // 6 = 4 (msgID) + 2 (size)
|
||||||
|
|
||||||
// first fragment
|
// first fragment
|
||||||
di[0] |= 0x08; // fragmented
|
di[0] |= 0x08; // fragmented
|
||||||
*(uint32_t *)(di + diLen) = htobe32 (msgID);
|
*(uint32_t *)(di + diLen) = msgID;
|
||||||
diLen += 4; // Message ID
|
diLen += 4; // Message ID
|
||||||
*(uint16_t *)(di + diLen) = htobe16 (size);
|
*(uint16_t *)(di + diLen) = htobe16 (size);
|
||||||
diLen += 2; // size
|
diLen += 2; // size
|
||||||
@ -80,7 +80,7 @@ namespace tunnel
|
|||||||
buf[0] |= 0x01;
|
buf[0] |= 0x01;
|
||||||
isLastFragment = true;
|
isLastFragment = true;
|
||||||
}
|
}
|
||||||
*(uint32_t *)(buf + 1) = htobe32 (msgID); //Message ID
|
*(uint32_t *)(buf + 1) = msgID; //Message ID
|
||||||
*(uint16_t *)(buf + 5) = htobe16 (s); // size
|
*(uint16_t *)(buf + 5) = htobe16 (s); // size
|
||||||
memcpy (buf + 7, msg->GetBuffer () + size, s);
|
memcpy (buf + 7, msg->GetBuffer () + size, s);
|
||||||
m_CurrentTunnelDataMsg->len += s+7;
|
m_CurrentTunnelDataMsg->len += s+7;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user