From 510be8044932ad30ce5a8f61ecae220852b50a3d Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Thu, 10 Aug 2023 15:29:10 +0500 Subject: [PATCH] Store and init protocol parameters --- rtmp/server.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rtmp/server.go b/rtmp/server.go index 08edba8..ed6b474 100644 --- a/rtmp/server.go +++ b/rtmp/server.go @@ -4,6 +4,13 @@ import ( "net" ) +type ProtocolParams struct { + peer_chunk_size uint32 + chunk_size uint32 + peer_ack_win uint32 + curr_read uint32 +} + func NewServer(port *string) (error) { l, err := net.Listen("tcp", ":" + *port) if err != nil { @@ -33,7 +40,9 @@ func handle_conn(conn net.Conn, stream_live *bool) { if !DoHandshake(conn) { return } - if !NegotiateConnect(conn) { + params := ProtocolParams{1024, 512, 0, 0} + open_chnkstrms, open_msgs, chunk_buffers := OpenStreamsMapInit() + if !NegotiateConnect(conn, ¶ms, open_chnkstrms, open_msgs, chunk_buffers) { return }