fix(net): close of closed channel (#7580)

This commit is contained in:
hshpy 2024-12-17 22:04:27 +08:00 committed by GitHub
parent cf58ab3a78
commit 331885ed64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 5 deletions

View File

@ -169,9 +169,7 @@ func (d *downloader) sendChunkTask() *chunk {
// when the final reader Close, we interrupt
func (d *downloader) interrupt() error {
if d.chunkChannel == nil {
return nil
}
d.cancel()
if d.written != d.params.Range.Length {
log.Debugf("Downloader interrupt before finish")
@ -181,7 +179,6 @@ func (d *downloader) interrupt() error {
}
defer func() {
close(d.chunkChannel)
d.chunkChannel = nil
for _, buf := range d.bufs {
buf.Close()
}

View File

@ -174,7 +174,7 @@ func ServeHTTP(w http.ResponseWriter, r *http.Request, name string, modTime time
pw.Close()
}()
}
defer sendContent.Close()
//defer sendContent.Close()
w.Header().Set("Accept-Ranges", "bytes")
if w.Header().Get("Content-Encoding") == "" {