mirror of
				https://github.com/owncast/owncast.git
				synced 2025-11-04 13:27:21 +08:00 
			
		
		
		
	Break rtmp read loop after disconnect
This commit is contained in:
		@ -14,12 +14,12 @@ import (
 | 
				
			|||||||
	"github.com/nareix/joy5/format/flv/flvio"
 | 
						"github.com/nareix/joy5/format/flv/flvio"
 | 
				
			||||||
	log "github.com/sirupsen/logrus"
 | 
						log "github.com/sirupsen/logrus"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"github.com/nareix/joy5/format/rtmp"
 | 
				
			||||||
	"github.com/owncast/owncast/config"
 | 
						"github.com/owncast/owncast/config"
 | 
				
			||||||
	"github.com/owncast/owncast/core"
 | 
						"github.com/owncast/owncast/core"
 | 
				
			||||||
	"github.com/owncast/owncast/core/ffmpeg"
 | 
						"github.com/owncast/owncast/core/ffmpeg"
 | 
				
			||||||
	"github.com/owncast/owncast/models"
 | 
						"github.com/owncast/owncast/models"
 | 
				
			||||||
	"github.com/owncast/owncast/utils"
 | 
						"github.com/owncast/owncast/utils"
 | 
				
			||||||
	"github.com/nareix/joy5/format/rtmp"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
@ -131,10 +131,14 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) {
 | 
				
			|||||||
	w := flv.NewMuxer(f)
 | 
						w := flv.NewMuxer(f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for {
 | 
						for {
 | 
				
			||||||
 | 
							if !_isConnected {
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pkt, err := c.ReadPacket()
 | 
							pkt, err := c.ReadPacket()
 | 
				
			||||||
		if err == io.EOF {
 | 
							if err == io.EOF {
 | 
				
			||||||
			handleDisconnect(nc)
 | 
								handleDisconnect(nc)
 | 
				
			||||||
			return
 | 
								break
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if err := w.WritePacket(pkt); err != nil {
 | 
							if err := w.WritePacket(pkt); err != nil {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user