close stream

This commit is contained in:
Asim Aslam 2020-01-19 22:55:57 +00:00
parent 9df19e826e
commit 04cf86070c

View File

@ -42,8 +42,6 @@ func newWatcher(rsp pb.Router_WatchService, opts router.WatchOptions) (*watcher,
// watchRouter watches router and send events to all registered watchers // watchRouter watches router and send events to all registered watchers
func (w *watcher) watch(stream pb.Router_WatchService) error { func (w *watcher) watch(stream pb.Router_WatchService) error {
defer stream.Close()
var watchErr error var watchErr error
for { for {
@ -110,6 +108,7 @@ func (w *watcher) Stop() {
case <-w.done: case <-w.done:
return return
default: default:
w.stream.Close()
close(w.done) close(w.done)
} }
} }