diff options
Diffstat (limited to 'server/bmp.go')
-rw-r--r-- | server/bmp.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/server/bmp.go b/server/bmp.go index 90928acd..3f845b27 100644 --- a/server/bmp.go +++ b/server/bmp.go @@ -224,8 +224,10 @@ func (w *bmpWatcher) loop() error { case conn := <-w.endCh: host := conn.RemoteAddr().String() log.Debugf("bmp connection to %s killed", host) - w.connMap[host].conn = nil - go w.tryConnect(w.connMap[host]) + if _, y := w.connMap[host]; y { + w.connMap[host].conn = nil + go w.tryConnect(w.connMap[host]) + } } } } @@ -261,6 +263,16 @@ func (w *bmpWatcher) addServer(c config.BmpServerConfig) error { return <-ch } +func (w *bmpWatcher) deleteServer(c config.BmpServerConfig) error { + ch := make(chan error) + w.ctlCh <- &bmpConfig{ + config: c, + del: true, + errCh: ch, + } + return <-ch +} + func (w *bmpWatcher) watchingEventTypes() []watcherEventType { state := false pre := false |