Browse Source

don't handle same message twice

pull/102/head
orignal 10 years ago
parent
commit
964e27bc15
  1. 14
      SSUData.cpp
  2. 1
      SSUData.h

14
SSUData.cpp

@ -221,7 +221,19 @@ namespace ssu @@ -221,7 +221,19 @@ namespace ssu
SendMsgAck (msgID);
msg->FromSSU (msgID);
if (m_Session.GetState () == eSessionStateEstablished)
i2p::HandleI2NPMessage (msg);
{
if (!m_ReceivedMessages.count (msgID))
{
if (m_ReceivedMessages.size () > 100) m_ReceivedMessages.clear ();
m_ReceivedMessages.insert (msgID);
i2p::HandleI2NPMessage (msg);
}
else
{
LogPrint ("SSU message ", msgID, " already received");
i2p::DeleteI2NPMessage (msg);
}
}
else
{
// we expect DeliveryStatus

1
SSUData.h

@ -100,6 +100,7 @@ namespace ssu @@ -100,6 +100,7 @@ namespace ssu
SSUSession& m_Session;
std::map<uint32_t, IncompleteMessage *> m_IncomleteMessages;
std::map<uint32_t, SentMessage *> m_SentMessages;
std::set<uint32_t> m_ReceivedMessages;
boost::asio::deadline_timer m_ResendTimer;
int m_PacketSize;
};

Loading…
Cancel
Save