Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 331885e

Browse files
authored
fix(net): close of closed channel (AlistGo#7580)
1 parent cf58ab3 commit 331885e

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

internal/net/request.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ func (d *downloader) sendChunkTask() *chunk {
169169

170170
// when the final reader Close, we interrupt
171171
func (d *downloader) interrupt() error {
172-
if d.chunkChannel == nil {
173-
return nil
174-
}
172+
175173
d.cancel()
176174
if d.written != d.params.Range.Length {
177175
log.Debugf("Downloader interrupt before finish")
@@ -181,7 +179,6 @@ func (d *downloader) interrupt() error {
181179
}
182180
defer func() {
183181
close(d.chunkChannel)
184-
d.chunkChannel = nil
185182
for _, buf := range d.bufs {
186183
buf.Close()
187184
}

internal/net/serve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func ServeHTTP(w http.ResponseWriter, r *http.Request, name string, modTime time
174174
pw.Close()
175175
}()
176176
}
177-
defer sendContent.Close()
177+
//defer sendContent.Close()
178178

179179
w.Header().Set("Accept-Ranges", "bytes")
180180
if w.Header().Get("Content-Encoding") == "" {

0 commit comments

Comments
 (0)