Browse Source

make sure DeliveryStatus and DatabseStore are sent first

pull/157/head
orignal 10 years ago
parent
commit
f846b87590
  1. 3
      SSUData.cpp
  2. 4
      SSUSession.cpp

3
SSUData.cpp

@ -298,7 +298,6 @@ namespace transport
sentMessage->nextResendTime = i2p::util::GetSecondsSinceEpoch () + RESEND_INTERVAL; sentMessage->nextResendTime = i2p::util::GetSecondsSinceEpoch () + RESEND_INTERVAL;
sentMessage->numResends = 0; sentMessage->numResends = 0;
auto& fragments = sentMessage->fragments; 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 payloadSize = m_PacketSize - sizeof (SSUHeader) - 9; // 9 = flag + #frg(1) + messageID(4) + frag info (3)
size_t len = msg->GetLength (); size_t len = msg->GetLength ();
uint8_t * msgBuf = msg->GetSSUHeader (); uint8_t * msgBuf = msg->GetSSUHeader ();
@ -314,7 +313,7 @@ namespace transport
payload++; payload++;
*payload = 1; // always 1 message fragment per message *payload = 1; // always 1 message fragment per message
payload++; payload++;
*(uint32_t *)payload = msgID; htobe32buf (payload, msgID);
payload += 4; payload += 4;
bool isLast = (len <= payloadSize); bool isLast = (len <= payloadSize);
size_t size = isLast ? len : payloadSize; size_t size = isLast ? len : payloadSize;

4
SSUSession.cpp

@ -255,7 +255,7 @@ namespace transport
if (paddingSize > 0) paddingSize = 16 - paddingSize; if (paddingSize > 0) paddingSize = 16 - paddingSize;
payload += paddingSize; payload += paddingSize;
// TODO: verify signature (need data from session request), payload points to signature // TODO: verify signature (need data from session request), payload points to signature
SendI2NPMessage (CreateDeliveryStatusMsg (0)); m_Data.Send (CreateDeliveryStatusMsg (0));
Established (); Established ();
} }
@ -767,7 +767,7 @@ namespace transport
delete m_DHKeysPair; delete m_DHKeysPair;
m_DHKeysPair = nullptr; m_DHKeysPair = nullptr;
} }
SendI2NPMessage (CreateDatabaseStoreMsg ()); m_Data.Send (CreateDatabaseStoreMsg ());
transports.PeerConnected (shared_from_this ()); transports.PeerConnected (shared_from_this ());
if (m_PeerTest && (m_RemoteRouter && m_RemoteRouter->IsPeerTesting ())) if (m_PeerTest && (m_RemoteRouter && m_RemoteRouter->IsPeerTesting ()))
SendPeerTest (); SendPeerTest ();

Loading…
Cancel
Save