summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-10-05 14:36:36 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-10-05 14:36:36 +0900
commitcd85e47be29ca4e27bbbb0853fb215a903827cd4 (patch)
tree8e605cd92c1be35654b68da459877c161d69d451 /server
parent6416a6dafbfe78360b31ce5340722bab48a077c2 (diff)
server: stop Shutdown() with no peer
After Shutdown() is called, the main goroutine waits for peers' goroutines to stop then dies. But if no peer is configured, the main goroutines never dies. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/server.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go
index bb208846..03b9cbd2 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1144,6 +1144,10 @@ func (s *BgpServer) Shutdown() {
for _, p := range s.neighborMap {
p.fsm.adminStateCh <- stateOp
}
+ // the main goroutine waits for peers' goroutines to stop but if no peer is configured, needs to die immediately.
+ if len(s.neighborMap) == 0 {
+ os.Exit(0)
+ }
// TODO: call fsmincomingCh.Close()
return nil
}, false)