mirror of
https://github.com/Monibuca/plugin-rtmp.git
synced 2025-12-24 10:30:57 +08:00
fix: stop publisher and subscriber when conn closed
This commit is contained in:
@@ -37,6 +37,14 @@ func (config *RTMPConfig) ServeTCP(conn net.Conn) {
|
||||
defer conn.Close()
|
||||
senders := make(map[uint32]*RTMPSubscriber)
|
||||
receivers := make(map[uint32]*RTMPReceiver)
|
||||
defer func() {
|
||||
for _, sender := range senders {
|
||||
sender.Stop()
|
||||
}
|
||||
for _, receiver := range receivers {
|
||||
receiver.Stop()
|
||||
}
|
||||
}()
|
||||
nc := NewNetConnection(conn)
|
||||
ctx, cancel := context.WithCancel(engine.Engine)
|
||||
defer cancel()
|
||||
|
||||
Reference in New Issue
Block a user