Write Lock() advert update: we are writing into peers map here

This commit is contained in:
Milos Gajdos 2019-09-10 12:51:09 +01:00
parent baf4c05663
commit 4c709f7ac1
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F

View File

@ -586,7 +586,7 @@ func (n *network) processCtrlChan(client transport.Client, listener tunnel.Liste
continue continue
} }
// loookup advertising node in our peers // loookup advertising node in our peers
n.RLock() n.Lock()
log.Debugf("Network received advert message from: %s", pbRtrAdvert.Id) log.Debugf("Network received advert message from: %s", pbRtrAdvert.Id)
advertNode, ok := n.peers[pbRtrAdvert.Id] advertNode, ok := n.peers[pbRtrAdvert.Id]
if !ok { if !ok {
@ -603,7 +603,7 @@ func (n *network) processCtrlChan(client transport.Client, listener tunnel.Liste
log.Debugf("Network failed to send solicit message: %s", err) log.Debugf("Network failed to send solicit message: %s", err)
} }
} }
n.RUnlock() n.Unlock()
var events []*router.Event var events []*router.Event
for _, event := range pbRtrAdvert.Events { for _, event := range pbRtrAdvert.Events {