From e026a83d06d56993f3f120ed86f1a30f781882d0 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Mon, 21 Aug 2023 18:43:35 +0500 Subject: [PATCH] Proper deferred stream state flip on connection break --- rtmp/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rtmp/server.go b/rtmp/server.go index 406ca6b..4ff6216 100644 --- a/rtmp/server.go +++ b/rtmp/server.go @@ -39,6 +39,9 @@ func start(l net.Listener) { func handle_conn(conn net.Conn, stream_live *bool) { defer conn.Close() + defer func(a *bool) { + *a = false + }(stream_live) if !DoHandshake(conn) { return } @@ -54,5 +57,4 @@ func handle_conn(conn net.Conn, stream_live *bool) { } HandleDataLoop(chunk_wrapper) go StreamCleanup(chunk_wrapper.params.stream_key, 60) - *stream_live = false }