feat: casecade plugin support multi server

This commit is contained in:
pggiroro
2026-03-19 11:12:18 +08:00
parent d9f3e737fb
commit f18bcbc232
15 changed files with 1764 additions and 154 deletions
+28
View File
@@ -35,3 +35,31 @@ func (p *Puller) Start() (err error) {
_, err = fmt.Fprintf(stream, "%s %s\r\n", "PULLFLV", p.PullJob.Publisher.StreamPath)
return
}
// Dispose 发送 STOPFLV 命令,然后关闭 Stream
func (p *Puller) Dispose() {
if p.ReadCloser != nil {
// 先发送停止命令
if w, ok := p.ReadCloser.(interface{ Write([]byte) (int, error) }); ok {
fmt.Fprintf(w, "STOPFLV %s\r\n", p.PullJob.Publisher.StreamPath)
fmt.Printf("[cascade] 发送 STOPFLV: %s\n", p.PullJob.Publisher.StreamPath)
}
// 关闭 Stream
p.ReadCloser.Close()
p.ReadCloser = nil
}
}
// Dispose 发送 STOPFLV 命令,然后关闭 Stream
func (p *Puller) Dispose() {
if p.ReadCloser != nil {
// 先发送停止命令
if w, ok := p.ReadCloser.(interface{ Write([]byte) (int, error) }); ok {
fmt.Fprintf(w, "STOPFLV %s\r\n", p.PullJob.Publisher.StreamPath)
fmt.Printf("[cascade] 发送 STOPFLV: %s\n", p.PullJob.Publisher.StreamPath)
}
// 关闭 Stream
p.ReadCloser.Close()
p.ReadCloser = nil
}
}