From 3f2890a85876b0dd74502e8bfbb5d4db8fe49fbd Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Tue, 27 Feb 2024 14:44:12 +0500 Subject: [PATCH] wrap read in io.ReadFull so that it actually reads everything over latency between TCP packets --- rtmp/chunk.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtmp/chunk.go b/rtmp/chunk.go index 52bf060..5784ad5 100644 --- a/rtmp/chunk.go +++ b/rtmp/chunk.go @@ -1,6 +1,7 @@ package rtmp import ( + "io" "net" "time" "encoding/binary" @@ -225,7 +226,7 @@ func read_chunk_data(conn net.Conn, msg_ptr *Message, chnk_size uint32) (uint32, } else { buffer_end = chnk_size + msg_ptr.curr_bytes_read } - n, err := conn.Read(msg_ptr.data[msg_ptr.curr_bytes_read:buffer_end]) + n, err := io.ReadFull(conn, msg_ptr.data[msg_ptr.curr_bytes_read:buffer_end]) if err != nil { return 0, err }