avoid close closed channel

This commit is contained in:
Chris Lu committed 2020-10-20 22:54:34 -07:00
1 parent 20442dc1bc
commit ad652ffb97
1 file changed
+4 -2
+4 -2
View File
@@ -185,8 +185,10 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) err
}
// stop the goroutine
fh.dirtyPages.chunkSaveErrChanClosed = true
close(fh.dirtyPages.chunkSaveErrChan)
if !fh.dirtyPages.chunkSaveErrChanClosed {
fh.dirtyPages.chunkSaveErrChanClosed = true
close(fh.dirtyPages.chunkSaveErrChan)
}
return nil
}