diff options
author | Keuin <[email protected]> | 2022-09-08 00:54:21 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-09-08 00:54:21 +0800 |
commit | 1009e88ff752525966708c56190c2dfa32bc9537 (patch) | |
tree | 42bc6d6fb3ab09b4326f4256a18b24ce5eb1ad29 /bilibili | |
parent | ffdd3af907215bbeb4c470244643f2337261c2f8 (diff) |
Remove unnecessary boolean flag.
Diffstat (limited to 'bilibili')
-rw-r--r-- | bilibili/streaming.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bilibili/streaming.go b/bilibili/streaming.go index ec99565..5407043 100644 --- a/bilibili/streaming.go +++ b/bilibili/streaming.go @@ -3,6 +3,7 @@ package bilibili import ( "bilibili-livestream-archiver/common" "context" + "errors" "fmt" "io" "net/http" @@ -59,14 +60,13 @@ func (b Bilibili) CopyLiveStream( defer cancelGuardian() // blocking copy - n, err, isCancelled := common.Copy(ctx, out, resp.Body) + n, err := common.Copy(ctx, out, resp.Body) - if isCancelled { + if errors.Is(err, context.Canceled) { // cancelled by context // this error is useless err = nil - } - if !isCancelled && err != nil { + } else { // real error happens b.error.Printf("Stream copying was interrupted unexpectedly: %v", err) } |