From 493ad1a723f9ade3bd049b156f0dc4d194f8fd3e Mon Sep 17 00:00:00 2001 From: Keuin Date: Thu, 8 Sep 2022 01:14:20 +0800 Subject: Completely fix timing of goroutines. Implement graceful shutdown correctly. --- bilibili/streaming.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'bilibili/streaming.go') diff --git a/bilibili/streaming.go b/bilibili/streaming.go index 5407043..f6ffac9 100644 --- a/bilibili/streaming.go +++ b/bilibili/streaming.go @@ -62,11 +62,7 @@ func (b Bilibili) CopyLiveStream( // blocking copy n, err := common.Copy(ctx, out, resp.Body) - if errors.Is(err, context.Canceled) { - // cancelled by context - // this error is useless - err = nil - } else { + if !errors.Is(err, context.Canceled) { // real error happens b.error.Printf("Stream copying was interrupted unexpectedly: %v", err) } -- cgit v1.2.3