From ac808d51d626cd8d019b9a61270ffa5518053d81 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 3 Feb 2021 18:56:07 -0500 Subject: [PATCH] Crash fix --- node/Peer.cpp | 2 +- node/Peer.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/node/Peer.cpp b/node/Peer.cpp index b9237e694..fb405ad92 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -156,7 +156,7 @@ void Peer::received( Mutex::Lock ltl(_lastTriedPath_m); bool triedTooRecently = false; - for(std::vector< std::pair< Path *, int64_t > >::iterator i(_lastTriedPath.begin());i!=_lastTriedPath.end();) { + for(std::list< std::pair< Path *, int64_t > >::iterator i(_lastTriedPath.begin());i!=_lastTriedPath.end();) { if ((now - i->second) > 1000) { _lastTriedPath.erase(i++); } else if (i->first == path.ptr()) { diff --git a/node/Peer.hpp b/node/Peer.hpp index c300952fe..4a0dad928 100644 --- a/node/Peer.hpp +++ b/node/Peer.hpp @@ -15,6 +15,7 @@ #define ZT_PEER_HPP #include +#include #include "../include/ZeroTierOne.h" @@ -573,7 +574,7 @@ private: uint16_t _vMinor; uint16_t _vRevision; - std::vector< std::pair< Path *, int64_t > > _lastTriedPath; + std::list< std::pair< Path *, int64_t > > _lastTriedPath; Mutex _lastTriedPath_m; _PeerPath _paths[ZT_MAX_PEER_NETWORK_PATHS];