1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

filenotify: don't close channels to avoid panic

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2016-02-19 14:37:33 -08:00
parent 9e83765d0f
commit 2251e5db3f
2 changed files with 4 additions and 20 deletions

View file

@ -118,8 +118,10 @@ func (w *filePoller) Close() error {
w.remove(name)
delete(w.watches, name)
}
close(w.events)
close(w.errors)
// channels will be closed by GC, we don't do it to avoid panic in send
// functions
// close(w.events)
// close(w.errors)
return nil
}

View file

@ -89,24 +89,6 @@ func TestPollerClose(t *testing.T) {
t.Fatal(err)
}
select {
case _, open := <-w.Events():
if open {
t.Fatal("event chan should be closed")
}
default:
t.Fatal("event chan should be closed")
}
select {
case _, open := <-w.Errors():
if open {
t.Fatal("errors chan should be closed")
}
default:
t.Fatal("errors chan should be closed")
}
f, err := ioutil.TempFile("", "asdf")
if err != nil {
t.Fatal(err)