diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-08-23 17:14:06 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-08-23 17:14:06 -0700 |
commit | 4d5983114ca28cdad919e2cd7e6e1b5453c3b18c (patch) | |
tree | d4581eab41444120f726674bf8c340d4617c709b /node | |
parent | 0a9c3b557181a77f059d4b2957f6a02f7cc5bde5 (diff) | |
download | infinitytier-4d5983114ca28cdad919e2cd7e6e1b5453c3b18c.tar.gz infinitytier-4d5983114ca28cdad919e2cd7e6e1b5453c3b18c.zip |
Fix another deadlock.
Diffstat (limited to 'node')
-rw-r--r-- | node/Switch.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp index 62c3f450..fce12622 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -544,11 +544,16 @@ void Switch::onLocalEthernet(void *tPtr,const SharedPtr<Network> &network,const void Switch::send(void *tPtr,Packet &packet,bool encrypt) { - if (packet.destination() == RR->identity.address()) + const Address dest(packet.destination()); + if (dest == RR->identity.address()) return; if (!_trySend(tPtr,packet,encrypt)) { - Mutex::Lock _l(_txQueue_m); - _txQueue.push_back(TXQueueEntry(packet.destination(),RR->node->now(),packet,encrypt)); + { + Mutex::Lock _l(_txQueue_m); + _txQueue.push_back(TXQueueEntry(dest,RR->node->now(),packet,encrypt)); + } + if (!RR->topology->getPeer(tPtr,dest)) + requestWhois(tPtr,RR->node->now(),dest); } } @@ -714,7 +719,6 @@ bool Switch::_trySend(void *tPtr,Packet &packet,bool encrypt) } } } else { - requestWhois(tPtr,now,destination); return false; // if we are not in cluster mode, there is no way we can send without knowing the peer directly } |