fix(net): close of closed channel (#7529)
This commit is contained in:
parent
25c5e075a9
commit
4c0cffd29b
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/alist-org/alist/v3/pkg/utils"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
@ -13,6 +12,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/alist-org/alist/v3/pkg/utils"
|
||||
|
||||
"github.com/alist-org/alist/v3/pkg/http_range"
|
||||
"github.com/aws/aws-sdk-go/aws/awsutil"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -168,6 +169,9 @@ 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")
|
||||
@ -177,6 +181,7 @@ func (d *downloader) interrupt() error {
|
||||
}
|
||||
defer func() {
|
||||
close(d.chunkChannel)
|
||||
d.chunkChannel = nil
|
||||
for _, buf := range d.bufs {
|
||||
buf.Close()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user