mirror of
https://github.com/osrg/gobgp.git
synced 2024-05-11 05:55:10 +00:00
server: avoid deadlock
peer.ID() uses lock in itself.
This commit is contained in:
+2
-1
@@ -215,6 +215,7 @@ func (peer *peer) negotiatedRFList() []bgp.RouteFamily {
|
||||
}
|
||||
|
||||
func (peer *peer) toGlobalFamilies(families []bgp.RouteFamily) []bgp.RouteFamily {
|
||||
id := peer.ID()
|
||||
peer.fsm.lock.RLock()
|
||||
defer peer.fsm.lock.RUnlock()
|
||||
if peer.fsm.pConf.Config.Vrf != "" {
|
||||
@@ -228,7 +229,7 @@ func (peer *peer) toGlobalFamilies(families []bgp.RouteFamily) []bgp.RouteFamily
|
||||
default:
|
||||
log.WithFields(log.Fields{
|
||||
"Topic": "Peer",
|
||||
"Key": peer.ID(),
|
||||
"Key": id,
|
||||
"Family": f,
|
||||
"VRF": peer.fsm.pConf.Config.Vrf,
|
||||
}).Warn("invalid family configured for neighbor with vrf")
|
||||
|
||||
@@ -1695,13 +1695,12 @@ func (s *BgpServer) SetPolicies(ctx context.Context, r *api.SetPoliciesRequest)
|
||||
"Topic": "Peer",
|
||||
"Key": peer.fsm.pConf.State.NeighborAddress,
|
||||
}).Info("call set policy")
|
||||
peer.fsm.lock.RUnlock()
|
||||
a, err := getConfig(peer.ID())
|
||||
if err != nil {
|
||||
peer.fsm.lock.RUnlock()
|
||||
return err
|
||||
}
|
||||
ap[peer.ID()] = *a
|
||||
peer.fsm.lock.RUnlock()
|
||||
}
|
||||
return s.policy.Reset(rp, ap)
|
||||
}, false)
|
||||
|
||||
Reference in New Issue
Block a user