diff options
Diffstat (limited to 'cmd/gobgpd/main.go')
-rw-r--r-- | cmd/gobgpd/main.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go index e0fcda33..a1351ff1 100644 --- a/cmd/gobgpd/main.go +++ b/cmd/gobgpd/main.go @@ -167,10 +167,7 @@ func main() { for { select { case <-sigCh: - bgpServer.StopBgp(context.Background(), &api.StopBgpRequest{}) - if opts.UseSdNotify { - daemon.SdNotify(false, daemon.SdNotifyStopping) - } + stopServer(bgpServer, opts.UseSdNotify) return case newConfig := <-configCh: c = config_api.UpdateConfig(bgpServer, c, newConfig) @@ -180,3 +177,10 @@ func main() { loop() } + +func stopServer(bgpServer *server.BgpServer, useSdNotify bool) { + bgpServer.StopBgp(context.Background(), &api.StopBgpRequest{}) + if useSdNotify { + daemon.SdNotify(false, daemon.SdNotifyStopping) + } +} |