Skip to content

Commit

Permalink
correct endianess for msgID
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Sep 3, 2014
1 parent aaf386a commit f4afaca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions TunnelGateway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ namespace tunnel
if (diLen + 6 <= m_RemainingSize)
{
// 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)

// first fragment
di[0] |= 0x08; // fragmented
*(uint32_t *)(di + diLen) = htobe32 (msgID);
*(uint32_t *)(di + diLen) = msgID;
diLen += 4; // Message ID
*(uint16_t *)(di + diLen) = htobe16 (size);
diLen += 2; // size
Expand All @@ -80,7 +80,7 @@ namespace tunnel
buf[0] |= 0x01;
isLastFragment = true;
}
*(uint32_t *)(buf + 1) = htobe32 (msgID); //Message ID
*(uint32_t *)(buf + 1) = msgID; //Message ID
*(uint16_t *)(buf + 5) = htobe16 (s); // size
memcpy (buf + 7, msg->GetBuffer () + size, s);
m_CurrentTunnelDataMsg->len += s+7;
Expand Down

0 comments on commit f4afaca

Please sign in to comment.