Browse Source

cleanup

pull/483/head
aler9 4 years ago
parent
commit
9819ae43e8
  1. 2
      internal/conf/path.go
  2. 14
      internal/core/core.go

2
internal/conf/path.go

@ -73,7 +73,7 @@ type PathConf struct {
SourceProtocol string `yaml:"sourceProtocol"` SourceProtocol string `yaml:"sourceProtocol"`
SourceProtocolParsed *gortsplib.ClientProtocol `yaml:"-" json:"-"` SourceProtocolParsed *gortsplib.ClientProtocol `yaml:"-" json:"-"`
SourceAnyPortEnable bool `yaml:"sourceAnyPortEnable"` SourceAnyPortEnable bool `yaml:"sourceAnyPortEnable"`
SourceFingerprint string `yaml:"sourceFingerprint" json:"sourceFingerprint"` SourceFingerprint string `yaml:"sourceFingerprint"`
SourceOnDemand bool `yaml:"sourceOnDemand"` SourceOnDemand bool `yaml:"sourceOnDemand"`
SourceOnDemandStartTimeout time.Duration `yaml:"sourceOnDemandStartTimeout"` SourceOnDemandStartTimeout time.Duration `yaml:"sourceOnDemandStartTimeout"`
SourceOnDemandCloseAfter time.Duration `yaml:"sourceOnDemandCloseAfter"` SourceOnDemandCloseAfter time.Duration `yaml:"sourceOnDemandCloseAfter"`

14
internal/core/core.go

@ -352,7 +352,7 @@ func (p *Core) closeResources(newConf *conf.Conf) {
closePPROF = true closePPROF = true
} }
closePathMan := false closePathManager := false
if newConf == nil || if newConf == nil ||
newConf.RTSPAddress != p.conf.RTSPAddress || newConf.RTSPAddress != p.conf.RTSPAddress ||
newConf.ReadTimeout != p.conf.ReadTimeout || newConf.ReadTimeout != p.conf.ReadTimeout ||
@ -361,7 +361,7 @@ func (p *Core) closeResources(newConf *conf.Conf) {
newConf.ReadBufferSize != p.conf.ReadBufferSize || newConf.ReadBufferSize != p.conf.ReadBufferSize ||
!reflect.DeepEqual(newConf.AuthMethodsParsed, p.conf.AuthMethodsParsed) || !reflect.DeepEqual(newConf.AuthMethodsParsed, p.conf.AuthMethodsParsed) ||
closeStats { closeStats {
closePathMan = true closePathManager = true
} else if !reflect.DeepEqual(newConf.Paths, p.conf.Paths) { } else if !reflect.DeepEqual(newConf.Paths, p.conf.Paths) {
p.pathManager.OnConfReload(newConf.Paths) p.pathManager.OnConfReload(newConf.Paths)
} }
@ -385,7 +385,7 @@ func (p *Core) closeResources(newConf *conf.Conf) {
newConf.RunOnConnect != p.conf.RunOnConnect || newConf.RunOnConnect != p.conf.RunOnConnect ||
newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart || newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart ||
closeStats || closeStats ||
closePathMan { closePathManager {
closeServerPlain = true closeServerPlain = true
} }
@ -404,7 +404,7 @@ func (p *Core) closeResources(newConf *conf.Conf) {
newConf.RunOnConnect != p.conf.RunOnConnect || newConf.RunOnConnect != p.conf.RunOnConnect ||
newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart || newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart ||
closeStats || closeStats ||
closePathMan { closePathManager {
closeServerTLS = true closeServerTLS = true
} }
@ -419,7 +419,7 @@ func (p *Core) closeResources(newConf *conf.Conf) {
newConf.RunOnConnect != p.conf.RunOnConnect || newConf.RunOnConnect != p.conf.RunOnConnect ||
newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart || newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart ||
closeStats || closeStats ||
closePathMan { closePathManager {
closeServerRTMP = true closeServerRTMP = true
} }
@ -433,7 +433,7 @@ func (p *Core) closeResources(newConf *conf.Conf) {
newConf.HLSAllowOrigin != p.conf.HLSAllowOrigin || newConf.HLSAllowOrigin != p.conf.HLSAllowOrigin ||
newConf.ReadBufferCount != p.conf.ReadBufferCount || newConf.ReadBufferCount != p.conf.ReadBufferCount ||
closeStats || closeStats ||
closePathMan { closePathManager {
closeServerHLS = true closeServerHLS = true
} }
@ -447,7 +447,7 @@ func (p *Core) closeResources(newConf *conf.Conf) {
p.rtspServerPlain = nil p.rtspServerPlain = nil
} }
if closePathMan && p.pathManager != nil { if closePathManager && p.pathManager != nil {
p.pathManager.close() p.pathManager.close()
p.pathManager = nil p.pathManager = nil
} }

Loading…
Cancel
Save