Cancel NAT-t attempts if peer is no longer "alive"

This commit is contained in:
Adam Ierymenko 2015-07-28 12:18:59 -07:00
parent 5986d83738
commit 21e6850722

View File

@ -452,8 +452,8 @@ unsigned long Switch::doTimerTasks(uint64_t now)
Mutex::Lock _l(_contactQueue_m);
for(std::list<ContactQueueEntry>::iterator qi(_contactQueue.begin());qi!=_contactQueue.end();) {
if (now >= qi->fireAtTime) {
if (qi->peer->hasActiveDirectPath(now)) {
// We've successfully NAT-t'd, so cancel attempt
if ((!qi->peer->alive(now))||(qi->peer->hasActiveDirectPath(now))) {
// Cancel attempt if we've already connected or peer is no longer "alive"
_contactQueue.erase(qi++);
continue;
} else {