Merge pull request #1535 from majestrate/no-iwp-multiack-2021-02-13

only do single ack packets
pull/1567/head
Jeff 3 years ago committed by GitHub
commit 72c9b0f1b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -775,12 +775,7 @@ namespace llarp
return;
}
}
auto msg = std::move(itr->second);
const llarp_buffer_t buf(msg.m_Data);
m_Parent->HandleMessage(this, buf);
if (m_ReplayFilter.emplace(rxid, m_Parent->Now()).second)
m_SendMACKs.emplace(rxid);
m_RXMsgs.erase(rxid);
HandleRecvMsgCompleted(itr->second);
}
}
else
@ -827,20 +822,27 @@ namespace llarp
{
if (itr->second.Verify())
{
auto msg = std::move(itr->second);
const llarp_buffer_t buf(msg.m_Data);
m_Parent->HandleMessage(this, buf);
if (m_ReplayFilter.emplace(itr->first, m_Parent->Now()).second)
m_SendMACKs.emplace(itr->first);
HandleRecvMsgCompleted(itr->second);
}
else
{
LogError("hash mismatch for message ", itr->first);
}
m_RXMsgs.erase(itr);
}
}
void
Session::HandleRecvMsgCompleted(const InboundMessage& msg)
{
const auto rxid = msg.m_MsgID;
if (m_ReplayFilter.emplace(rxid, m_Parent->Now()).second)
{
m_Parent->HandleMessage(this, msg.m_Data);
EncryptAndSend(msg.ACKS());
}
m_RXMsgs.erase(rxid);
}
void
Session::HandleACKS(Packet_t data)
{

@ -6,6 +6,7 @@
#include <iwp/message_buffer.hpp>
#include <net/ip_address.hpp>
#include <map>
#include <unordered_set>
#include <deque>
#include <queue>
@ -185,8 +186,8 @@ namespace llarp
void
ResetRates();
std::unordered_map<uint64_t, InboundMessage> m_RXMsgs;
std::unordered_map<uint64_t, OutboundMessage> m_TXMsgs;
std::map<uint64_t, InboundMessage> m_RXMsgs;
std::map<uint64_t, OutboundMessage> m_TXMsgs;
/// maps rxid to time recieved
std::unordered_map<uint64_t, llarp_time_t> m_ReplayFilter;
@ -227,6 +228,9 @@ namespace llarp
void
SendMACK();
void
HandleRecvMsgCompleted(const InboundMessage& msg);
void
GenerateAndSendIntro();

@ -252,7 +252,7 @@ TEST_CASE("IWP send messages", "[iwp]")
std::function<void(void)> endTestNow,
Context_ptr alice,
Context_ptr bob) {
constexpr int numSend = 128;
constexpr int numSend = 64;
// when alice makes a session to bob send `aliceNumSend` messages to him
alice->InitLink<false>([endIfDone, alice, &aliceNumSent](auto session) {
for (auto index = 0; index < numSend; index++)

Loading…
Cancel
Save