summaryrefslogtreecommitdiffhomepage
path: root/pkg/server
diff options
context:
space:
mode:
authorEiichiro Watanabe <a16tochjp@gmail.com>2018-11-10 18:37:17 +0900
committerEiichiro Watanabe <a16tochjp@gmail.com>2018-11-10 18:37:17 +0900
commiteebc7291cec739ffd84b376bd2abaf3867944380 (patch)
tree7c874c27903af247d86a3a89010f48250689e14a /pkg/server
parent360f72818b60d471da1bf8cd673272e927595d4a (diff)
server: avoid deadlock
toConfig() uses lock in itself.
Diffstat (limited to 'pkg/server')
-rw-r--r--pkg/server/server.go6
1 files changed, 4 insertions, 2 deletions
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)