summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-11 16:00:54 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-11 16:19:57 +0900
commit292a61b9cc0e8cd0732f43f71661ac6ae0f441cd (patch)
treed5220fa5c8d30fb40d5d700a8bab857c59332664 /server/server.go
parentaa12e4c7ce9565727dd1c8977d38e4d31a71f408 (diff)
server: print correct reason of state change by configuration change
Changing some of configuration leads to sending a notification. So the reason of the BGP state change should be the notification. The main goroutine sends a notification, closes the connection, kill goroutines for the peer. So With the current code, the reason could be "rx failure", "tx failure", or "dying". To avoid that, this patch adds kinda workaround. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/server.go b/server/server.go
index c69b6b76..9cfe3d56 100644
--- a/server/server.go
+++ b/server/server.go
@@ -2410,6 +2410,9 @@ func (server *BgpServer) handleDelNeighbor(c *config.Neighbor, code, subcode uin
SetTcpMD5SigSockopts(l, addr, "")
}
log.Info("Delete a peer configuration for ", addr)
+
+ n.fsm.sendNotification(code, subcode, nil, "")
+
go func(addr string) {
t := time.AfterFunc(time.Minute*5, func() { log.Fatal("failed to free the fsm.h.t for ", addr) })
n.fsm.h.t.Kill(nil)
@@ -2422,9 +2425,6 @@ func (server *BgpServer) handleDelNeighbor(c *config.Neighbor, code, subcode uin
}(addr)
delete(server.neighborMap, addr)
m := server.dropPeerAllRoutes(n, n.configuredRFlist())
-
- n.fsm.sendNotification(code, subcode, nil, "")
-
return m, nil
}