Skip to content

Commit

Permalink
make sure DeliveryStatus and DatabseStore are sent first
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Feb 2, 2015
1 parent e3764be commit f846b87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions SSUData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ namespace transport
sentMessage->nextResendTime = i2p::util::GetSecondsSinceEpoch () + RESEND_INTERVAL;
sentMessage->numResends = 0;
auto& fragments = sentMessage->fragments;
msgID = htobe32 (msgID);
size_t payloadSize = m_PacketSize - sizeof (SSUHeader) - 9; // 9 = flag + #frg(1) + messageID(4) + frag info (3)
size_t len = msg->GetLength ();
uint8_t * msgBuf = msg->GetSSUHeader ();
Expand All @@ -314,7 +313,7 @@ namespace transport
payload++;
*payload = 1; // always 1 message fragment per message
payload++;
*(uint32_t *)payload = msgID;
htobe32buf (payload, msgID);
payload += 4;
bool isLast = (len <= payloadSize);
size_t size = isLast ? len : payloadSize;
Expand Down
4 changes: 2 additions & 2 deletions SSUSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ namespace transport
if (paddingSize > 0) paddingSize = 16 - paddingSize;
payload += paddingSize;
// TODO: verify signature (need data from session request), payload points to signature
SendI2NPMessage (CreateDeliveryStatusMsg (0));
m_Data.Send (CreateDeliveryStatusMsg (0));
Established ();
}

Expand Down Expand Up @@ -767,7 +767,7 @@ namespace transport
delete m_DHKeysPair;
m_DHKeysPair = nullptr;
}
SendI2NPMessage (CreateDatabaseStoreMsg ());
m_Data.Send (CreateDatabaseStoreMsg ());
transports.PeerConnected (shared_from_this ());
if (m_PeerTest && (m_RemoteRouter && m_RemoteRouter->IsPeerTesting ()))
SendPeerTest ();
Expand Down

0 comments on commit f846b87

Please sign in to comment.