From eebc7291cec739ffd84b376bd2abaf3867944380 Mon Sep 17 00:00:00 2001 From: Eiichiro Watanabe Date: Sat, 10 Nov 2018 18:37:17 +0900 Subject: server: avoid deadlock toConfig() uses lock in itself. --- pkg/server/server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkg/server/server.go') diff --git a/pkg/server/server.go b/pkg/server/server.go index 48cdc819..1377e4d0 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -737,6 +737,7 @@ func (server *BgpServer) notifyPrePolicyUpdateWatcher(peer *peer, pathList []*ta if len(cloned) == 0 { return } + n := server.toConfig(peer, false) peer.fsm.lock.RLock() _, y := peer.fsm.capMap[bgp.BGP_CAP_FOUR_OCTET_AS_NUMBER] l, _ := peer.fsm.LocalHostPort() @@ -752,7 +753,7 @@ func (server *BgpServer) notifyPrePolicyUpdateWatcher(peer *peer, pathList []*ta Payload: payload, PostPolicy: false, PathList: cloned, - Neighbor: server.toConfig(peer, false), + Neighbor: n, } peer.fsm.lock.RUnlock() server.notifyWatcher(watchEventTypePreUpdate, ev) @@ -767,6 +768,7 @@ func (server *BgpServer) notifyPostPolicyUpdateWatcher(peer *peer, pathList []*t if len(cloned) == 0 { return } + n := server.toConfig(peer, false) peer.fsm.lock.RLock() _, y := peer.fsm.capMap[bgp.BGP_CAP_FOUR_OCTET_AS_NUMBER] l, _ := peer.fsm.LocalHostPort() @@ -780,7 +782,7 @@ func (server *BgpServer) notifyPostPolicyUpdateWatcher(peer *peer, pathList []*t Timestamp: cloned[0].GetTimestamp(), PostPolicy: true, PathList: cloned, - Neighbor: server.toConfig(peer, false), + Neighbor: n, } peer.fsm.lock.RUnlock() server.notifyWatcher(watchEventTypePostUpdate, ev) -- cgit v1.2.3