don't handle same message twice

This commit is contained in:
orignal 2014-09-29 20:08:26 -04:00
parent d1a3f11c7a
commit 964e27bc15
2 changed files with 14 additions and 1 deletions

View File

@ -221,7 +221,19 @@ namespace ssu
SendMsgAck (msgID); SendMsgAck (msgID);
msg->FromSSU (msgID); msg->FromSSU (msgID);
if (m_Session.GetState () == eSessionStateEstablished) 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 else
{ {
// we expect DeliveryStatus // we expect DeliveryStatus

View File

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