mirror of
https://github.com/gwuhaolin/livego.git
synced 2021-06-01 09:10:22 +03:00
@@ -56,6 +56,7 @@ type FLVWriter struct {
|
||||
buf []byte
|
||||
closed chan struct{}
|
||||
ctx *os.File
|
||||
closedWriter bool
|
||||
}
|
||||
|
||||
func NewFLVWriter(app, title, url string, ctx *os.File) *FLVWriter {
|
||||
@@ -131,6 +132,10 @@ func (writer *FLVWriter) Wait() {
|
||||
}
|
||||
|
||||
func (writer *FLVWriter) Close(error) {
|
||||
if writer.closedWriter {
|
||||
return
|
||||
}
|
||||
writer.closedWriter = true
|
||||
writer.ctx.Close()
|
||||
close(writer.closed)
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ func (s *Stream) CheckAlive() (n int) {
|
||||
v := val.(*PackWriterCloser)
|
||||
if v.w != nil {
|
||||
//Alive from RWBaser, check last frame now - timestamp, if > timeout then Remove it
|
||||
if !v.w.Alive() && s.isStart {
|
||||
if !v.w.Alive() {
|
||||
log.Infof("write timeout remove")
|
||||
s.ws.Delete(key)
|
||||
v.w.Close(fmt.Errorf("write timeout"))
|
||||
|
||||
Reference in New Issue
Block a user