From: qydysky Date: Sun, 10 Mar 2024 10:28:01 +0000 (+0800) Subject: Improve 精简 X-Git-Tag: v0.13.5~1 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=f4140d4c561d659b2f2dcbb63a80ff701654d9e6;p=bili_danmu%2F.git Improve 精简 --- diff --git a/Reply/stream.go b/Reply/stream.go index 8da56ac..dc284d1 100644 --- a/Reply/stream.go +++ b/Reply/stream.go @@ -1467,10 +1467,8 @@ func (t *M4SStream) PusherToHttp(conn net.Conn, w http.ResponseWriter, r *http.R func (t *M4SStream) bootBufPush(buf []byte) { t.boot_buf_locker.Lock() defer t.boot_buf_locker.Unlock() - if len(t.boot_buf) < len(buf) { - t.boot_buf = append(t.boot_buf, make([]byte, len(buf)-len(t.boot_buf))...) - } - t.boot_buf = t.boot_buf[:copy(t.boot_buf, buf)] + t.boot_buf = t.boot_buf[:0] + t.boot_buf = append(t.boot_buf, buf...) } func (t *M4SStream) bootBufRead(r func(data []byte) error) error {