From d5d2301cad14769d17f59cafdac95a3b3e27aebe Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Thu, 10 Aug 2023 15:29:25 +0500 Subject: [PATCH] Loop chunk read --- rtmp/connect.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/rtmp/connect.go b/rtmp/connect.go index 29abca8..880d6fb 100644 --- a/rtmp/connect.go +++ b/rtmp/connect.go @@ -5,17 +5,15 @@ import ( "fmt" ) -func NegotiateConnect(conn net.Conn) (bool) { - open_chnkstrms, open_msgs, chunk_bufs := OpenStreamsMapInit() - full_msg_ptr, err := ReadChunk(conn, open_chnkstrms, open_msgs, 4096, chunk_bufs) - if err != nil { - return false +func NegotiateConnect(conn net.Conn, params *ProtocolParams, open_chnkstrms map[uint32]*ChunkStream, open_msgs map[uint32]*Message, chunk_bufs *ChunkBuffers) (bool) { + for { + full_msg_ptr, err := ReadChunk(conn, open_chnkstrms, open_msgs, params.peer_chunk_size, chunk_bufs, &(params.curr_read)) + if err != nil { + return false + } + if full_msg_ptr == nil { + continue + } + fmt.Println(*full_msg_ptr) } - fmt.Printf("%08b\n", full_msg_ptr.data) - full_msg_ptr, err = ReadChunk(conn, open_chnkstrms, open_msgs, 4096, chunk_bufs) - if err != nil { - return false - } - fmt.Printf("%08b\n", full_msg_ptr.data) - return false }