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 <[email protected]>
This commit is contained in:
FUJITA Tomonori
2017-10-05 14:36:36 +09:00
parent 6416a6dafb
commit cd85e47be2
+4
View File
@@ -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)