From bcf4cb09e7dc67ab67bc7674cb33c322b24737e8 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Wed, 7 Oct 2020 19:59:55 -0700 Subject: [PATCH] Break rtmp read loop after disconnect --- core/rtmp/rtmp.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/rtmp/rtmp.go b/core/rtmp/rtmp.go index 3e8303914..fefaee13d 100644 --- a/core/rtmp/rtmp.go +++ b/core/rtmp/rtmp.go @@ -14,12 +14,12 @@ import ( "github.com/nareix/joy5/format/flv/flvio" log "github.com/sirupsen/logrus" + "github.com/nareix/joy5/format/rtmp" "github.com/owncast/owncast/config" "github.com/owncast/owncast/core" "github.com/owncast/owncast/core/ffmpeg" "github.com/owncast/owncast/models" "github.com/owncast/owncast/utils" - "github.com/nareix/joy5/format/rtmp" ) var ( @@ -131,10 +131,14 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) { w := flv.NewMuxer(f) for { + if !_isConnected { + break + } + pkt, err := c.ReadPacket() if err == io.EOF { handleDisconnect(nc) - return + break } if err := w.WritePacket(pkt); err != nil {