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 }