close stream
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user