use unordered_map for incomplete and sent messages

This commit is contained in:
orignal 2020-08-08 13:34:27 -04:00
parent 9636d82b37
commit 8e25226574
2 changed files with 4 additions and 4 deletions

View File

@ -301,7 +301,7 @@ namespace transport
void SSUData::Send (std::shared_ptr<i2p::I2NPMessage> msg)
{
uint32_t msgID = msg->ToSSU ();
if (m_SentMessages.count (msgID) > 0)
if (m_SentMessages.find (msgID) != m_SentMessages.end())
{
LogPrint (eLogWarning, "SSU: message ", msgID, " already sent");
return;

View File

@ -11,7 +11,7 @@
#include <inttypes.h>
#include <string.h>
#include <map>
#include <unordered_map>
#include <vector>
#include <unordered_set>
#include <memory>
@ -124,8 +124,8 @@ namespace transport
private:
SSUSession& m_Session;
std::map<uint32_t, std::unique_ptr<IncompleteMessage> > m_IncompleteMessages;
std::map<uint32_t, std::unique_ptr<SentMessage> > m_SentMessages;
std::unordered_map<uint32_t, std::unique_ptr<IncompleteMessage> > m_IncompleteMessages;
std::unordered_map<uint32_t, std::unique_ptr<SentMessage> > m_SentMessages;
std::unordered_set<uint32_t> m_ReceivedMessages;
boost::asio::deadline_timer m_ResendTimer, m_IncompleteMessagesCleanupTimer;
int m_MaxPacketSize, m_PacketSize;