mirror of
https://github.com/lkmio/gb-cms.git
synced 2025-10-05 15:46:57 +08:00
fix: 提前释放stream发生crash问题
This commit is contained in:
1
main.go
1
main.go
@@ -126,7 +126,6 @@ func recoverStreams() ([]*Stream, []*Sink) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
Sugar.Infof("删除过期的推流会话 stream: %s", stream.ID)
|
Sugar.Infof("删除过期的推流会话 stream: %s", stream.ID)
|
||||||
closedStreams = append(closedStreams, stream)
|
closedStreams = append(closedStreams, stream)
|
||||||
stream.Close(true, false)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -187,3 +187,10 @@ func CreateRequestFromDialog(dialog sip.Request, method sip.RequestMethod) sip.R
|
|||||||
func (s *Stream) CreateRequestFromDialog(method sip.RequestMethod) sip.Request {
|
func (s *Stream) CreateRequestFromDialog(method sip.RequestMethod) sip.Request {
|
||||||
return CreateRequestFromDialog(s.Dialog, method)
|
return CreateRequestFromDialog(s.Dialog, method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CloseStream(streamId StreamID, ms bool) {
|
||||||
|
stream := StreamManager.Remove(streamId)
|
||||||
|
if stream != nil {
|
||||||
|
stream.Close(true, ms)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user