mirror of
https://github.com/langhuihui/monibuca.git
synced 2026-04-23 03:17:16 +08:00
feat: casecade plugin support multi server
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user