Fix deadlock in refactored code.

This commit is contained in:
Adam Ierymenko 2014-03-21 14:31:10 -07:00
parent 8d3eb1a258
commit 4e26ade2df

View file

@ -68,10 +68,11 @@ void Peer::receive(
uint64_t inRePacketId,
Packet::Verb inReVerb,
uint64_t now)
{
if (!hops) { // direct packet
{
Mutex::Lock _l(_lock);
if (!hops) { // direct packet
// Update receive time on known paths
bool havePath = false;
for(std::vector<Path>::iterator p(_paths.begin());p!=_paths.end();++p) {
@ -87,6 +88,7 @@ void Peer::receive(
_paths.push_back(Path(remoteAddr,false,false));
_paths.back().received(now);
}
}
// Announce multicast LIKEs to peers to whom we have a direct link
if ((now - _lastAnnouncedTo) >= ((ZT_MULTICAST_LIKE_EXPIRE / 2) - 1000)) {
@ -95,12 +97,11 @@ void Peer::receive(
}
}
if (verb == Packet::VERB_FRAME) {
if (verb == Packet::VERB_FRAME)
_lastUnicastFrame = now;
} else if (verb == Packet::VERB_MULTICAST_FRAME) {
else if (verb == Packet::VERB_MULTICAST_FRAME)
_lastMulticastFrame = now;
}
}
bool Peer::send(const RuntimeEnvironment *_r,const void *data,unsigned int len,uint64_t now)
{