summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorCarl Baldwin <carl@ecbaldwin.net>2019-07-24 09:02:01 -0600
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-08-28 09:06:20 +0900
commitb480c15a9c4b2be41439e3648cb0701963d8efbf (patch)
tree0b64dfc80308c2091f86e45363afcb6a8bede460 /cmd
parent8faa1a704bc35fedee0d152255308afb3db7a0bf (diff)
Factor out stopServer
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gobgpd/main.go12
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)
+ }
+}