|
|
|
|
@ -191,53 +191,6 @@ func (p *program) createResources(initial bool) error {
@@ -191,53 +191,6 @@ func (p *program) createResources(initial bool) error {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if !p.conf.RTSPDisable && |
|
|
|
|
(p.conf.EncryptionParsed == conf.EncryptionNo || |
|
|
|
|
p.conf.EncryptionParsed == conf.EncryptionOptional) { |
|
|
|
|
if p.serverRTSPPlain == nil { |
|
|
|
|
_, useUDP := p.conf.ProtocolsParsed[gortsplib.StreamProtocolUDP] |
|
|
|
|
p.serverRTSPPlain, err = serverrtsp.New( |
|
|
|
|
p.conf.RTSPAddress, |
|
|
|
|
p.conf.ReadTimeout, |
|
|
|
|
p.conf.WriteTimeout, |
|
|
|
|
p.conf.ReadBufferCount, |
|
|
|
|
p.conf.ReadBufferSize, |
|
|
|
|
useUDP, |
|
|
|
|
p.conf.RTPAddress, |
|
|
|
|
p.conf.RTCPAddress, |
|
|
|
|
false, |
|
|
|
|
"", |
|
|
|
|
"", |
|
|
|
|
p) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if !p.conf.RTSPDisable && |
|
|
|
|
(p.conf.EncryptionParsed == conf.EncryptionStrict || |
|
|
|
|
p.conf.EncryptionParsed == conf.EncryptionOptional) { |
|
|
|
|
if p.serverRTSPTLS == nil { |
|
|
|
|
p.serverRTSPTLS, err = serverrtsp.New( |
|
|
|
|
p.conf.RTSPSAddress, |
|
|
|
|
p.conf.ReadTimeout, |
|
|
|
|
p.conf.WriteTimeout, |
|
|
|
|
p.conf.ReadBufferCount, |
|
|
|
|
p.conf.ReadBufferSize, |
|
|
|
|
false, |
|
|
|
|
"", |
|
|
|
|
"", |
|
|
|
|
true, |
|
|
|
|
p.conf.ServerCert, |
|
|
|
|
p.conf.ServerKey, |
|
|
|
|
p) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if !p.conf.RTMPDisable { |
|
|
|
|
if p.serverRTMP == nil { |
|
|
|
|
p.serverRTMP, err = serverrtmp.New( |
|
|
|
|
@ -286,17 +239,79 @@ func (p *program) createResources(initial bool) error {
@@ -286,17 +239,79 @@ func (p *program) createResources(initial bool) error {
|
|
|
|
|
p.conf.ProtocolsParsed, |
|
|
|
|
p.stats, |
|
|
|
|
p.pathMan, |
|
|
|
|
p.serverRTSPPlain, |
|
|
|
|
p.serverRTSPTLS, |
|
|
|
|
p.serverRTMP, |
|
|
|
|
p.serverHLS, |
|
|
|
|
p) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if !p.conf.RTSPDisable && |
|
|
|
|
(p.conf.EncryptionParsed == conf.EncryptionNo || |
|
|
|
|
p.conf.EncryptionParsed == conf.EncryptionOptional) { |
|
|
|
|
if p.serverRTSPPlain == nil { |
|
|
|
|
_, useUDP := p.conf.ProtocolsParsed[gortsplib.StreamProtocolUDP] |
|
|
|
|
p.serverRTSPPlain, err = serverrtsp.New( |
|
|
|
|
p.conf.RTSPAddress, |
|
|
|
|
p.conf.ReadTimeout, |
|
|
|
|
p.conf.WriteTimeout, |
|
|
|
|
p.conf.ReadBufferCount, |
|
|
|
|
p.conf.ReadBufferSize, |
|
|
|
|
useUDP, |
|
|
|
|
p.conf.RTPAddress, |
|
|
|
|
p.conf.RTCPAddress, |
|
|
|
|
false, |
|
|
|
|
"", |
|
|
|
|
"", |
|
|
|
|
p.conf.RTSPAddress, |
|
|
|
|
p.conf.ProtocolsParsed, |
|
|
|
|
p.conf.RunOnConnect, |
|
|
|
|
p.conf.RunOnConnectRestart, |
|
|
|
|
p.stats, |
|
|
|
|
p.pathMan, |
|
|
|
|
p) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if !p.conf.RTSPDisable && |
|
|
|
|
(p.conf.EncryptionParsed == conf.EncryptionStrict || |
|
|
|
|
p.conf.EncryptionParsed == conf.EncryptionOptional) { |
|
|
|
|
if p.serverRTSPTLS == nil { |
|
|
|
|
p.serverRTSPTLS, err = serverrtsp.New( |
|
|
|
|
p.conf.RTSPSAddress, |
|
|
|
|
p.conf.ReadTimeout, |
|
|
|
|
p.conf.WriteTimeout, |
|
|
|
|
p.conf.ReadBufferCount, |
|
|
|
|
p.conf.ReadBufferSize, |
|
|
|
|
false, |
|
|
|
|
"", |
|
|
|
|
"", |
|
|
|
|
true, |
|
|
|
|
p.conf.ServerCert, |
|
|
|
|
p.conf.ServerKey, |
|
|
|
|
p.conf.RTSPAddress, |
|
|
|
|
p.conf.ProtocolsParsed, |
|
|
|
|
p.conf.RunOnConnect, |
|
|
|
|
p.conf.RunOnConnectRestart, |
|
|
|
|
p.stats, |
|
|
|
|
p.pathMan, |
|
|
|
|
p) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (p *program) closeResources(newConf *conf.Conf) { |
|
|
|
|
closeStats := false |
|
|
|
|
if newConf == nil { |
|
|
|
|
closeStats = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeLogger := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
!reflect.DeepEqual(newConf.LogDestinationsParsed, p.conf.LogDestinationsParsed) || |
|
|
|
|
@ -307,56 +322,33 @@ func (p *program) closeResources(newConf *conf.Conf) {
@@ -307,56 +322,33 @@ func (p *program) closeResources(newConf *conf.Conf) {
|
|
|
|
|
closeMetrics := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
newConf.Metrics != p.conf.Metrics || |
|
|
|
|
newConf.MetricsAddress != p.conf.MetricsAddress { |
|
|
|
|
newConf.MetricsAddress != p.conf.MetricsAddress || |
|
|
|
|
closeStats { |
|
|
|
|
closeMetrics = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closePPROF := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
newConf.PPROF != p.conf.PPROF || |
|
|
|
|
newConf.PPROFAddress != p.conf.PPROFAddress { |
|
|
|
|
newConf.PPROFAddress != p.conf.PPROFAddress || |
|
|
|
|
closeStats { |
|
|
|
|
closePPROF = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeServerPlain := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
newConf.RTSPDisable != p.conf.RTSPDisable || |
|
|
|
|
newConf.EncryptionParsed != p.conf.EncryptionParsed || |
|
|
|
|
newConf.RTSPAddress != p.conf.RTSPAddress || |
|
|
|
|
newConf.ReadTimeout != p.conf.ReadTimeout || |
|
|
|
|
newConf.WriteTimeout != p.conf.WriteTimeout || |
|
|
|
|
newConf.ReadBufferCount != p.conf.ReadBufferCount || |
|
|
|
|
!reflect.DeepEqual(newConf.ProtocolsParsed, p.conf.ProtocolsParsed) || |
|
|
|
|
newConf.RTPAddress != p.conf.RTPAddress || |
|
|
|
|
newConf.RTCPAddress != p.conf.RTCPAddress { |
|
|
|
|
closeServerPlain = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeServerTLS := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
newConf.RTSPDisable != p.conf.RTSPDisable || |
|
|
|
|
newConf.EncryptionParsed != p.conf.EncryptionParsed || |
|
|
|
|
newConf.RTSPSAddress != p.conf.RTSPSAddress || |
|
|
|
|
newConf.ReadTimeout != p.conf.ReadTimeout || |
|
|
|
|
newConf.WriteTimeout != p.conf.WriteTimeout || |
|
|
|
|
newConf.ReadBufferCount != p.conf.ReadBufferCount || |
|
|
|
|
newConf.ServerCert != p.conf.ServerCert || |
|
|
|
|
newConf.ServerKey != p.conf.ServerKey { |
|
|
|
|
closeServerTLS = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeServerRTMP := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
newConf.RTMPDisable != p.conf.RTMPDisable || |
|
|
|
|
newConf.RTMPAddress != p.conf.RTMPAddress || |
|
|
|
|
newConf.ReadTimeout != p.conf.ReadTimeout { |
|
|
|
|
newConf.ReadTimeout != p.conf.ReadTimeout || |
|
|
|
|
closeStats { |
|
|
|
|
closeServerRTMP = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeServerHLS := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
newConf.HLSDisable != p.conf.HLSDisable || |
|
|
|
|
newConf.HLSAddress != p.conf.HLSAddress { |
|
|
|
|
newConf.HLSAddress != p.conf.HLSAddress || |
|
|
|
|
closeStats { |
|
|
|
|
closeServerHLS = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -367,7 +359,8 @@ func (p *program) closeResources(newConf *conf.Conf) {
@@ -367,7 +359,8 @@ func (p *program) closeResources(newConf *conf.Conf) {
|
|
|
|
|
newConf.WriteTimeout != p.conf.WriteTimeout || |
|
|
|
|
newConf.ReadBufferCount != p.conf.ReadBufferCount || |
|
|
|
|
newConf.ReadBufferSize != p.conf.ReadBufferSize || |
|
|
|
|
!reflect.DeepEqual(newConf.AuthMethodsParsed, p.conf.AuthMethodsParsed) { |
|
|
|
|
!reflect.DeepEqual(newConf.AuthMethodsParsed, p.conf.AuthMethodsParsed) || |
|
|
|
|
closeStats { |
|
|
|
|
closePathMan = true |
|
|
|
|
} else if !reflect.DeepEqual(newConf.Paths, p.conf.Paths) { |
|
|
|
|
p.pathMan.OnProgramConfReload(newConf.Paths) |
|
|
|
|
@ -375,8 +368,6 @@ func (p *program) closeResources(newConf *conf.Conf) {
@@ -375,8 +368,6 @@ func (p *program) closeResources(newConf *conf.Conf) {
|
|
|
|
|
|
|
|
|
|
closeClientMan := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
closeServerPlain || |
|
|
|
|
closeServerTLS || |
|
|
|
|
closeServerRTMP || |
|
|
|
|
closeServerHLS || |
|
|
|
|
closePathMan || |
|
|
|
|
@ -388,13 +379,58 @@ func (p *program) closeResources(newConf *conf.Conf) {
@@ -388,13 +379,58 @@ func (p *program) closeResources(newConf *conf.Conf) {
|
|
|
|
|
newConf.ReadBufferCount != p.conf.ReadBufferCount || |
|
|
|
|
newConf.RunOnConnect != p.conf.RunOnConnect || |
|
|
|
|
newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart || |
|
|
|
|
!reflect.DeepEqual(newConf.ProtocolsParsed, p.conf.ProtocolsParsed) { |
|
|
|
|
!reflect.DeepEqual(newConf.ProtocolsParsed, p.conf.ProtocolsParsed) || |
|
|
|
|
closeStats { |
|
|
|
|
closeClientMan = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeStats := false |
|
|
|
|
if newConf == nil { |
|
|
|
|
closeStats = true |
|
|
|
|
closeServerPlain := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
newConf.RTSPDisable != p.conf.RTSPDisable || |
|
|
|
|
newConf.EncryptionParsed != p.conf.EncryptionParsed || |
|
|
|
|
newConf.RTSPAddress != p.conf.RTSPAddress || |
|
|
|
|
newConf.ReadTimeout != p.conf.ReadTimeout || |
|
|
|
|
newConf.WriteTimeout != p.conf.WriteTimeout || |
|
|
|
|
newConf.ReadBufferCount != p.conf.ReadBufferCount || |
|
|
|
|
!reflect.DeepEqual(newConf.ProtocolsParsed, p.conf.ProtocolsParsed) || |
|
|
|
|
newConf.RTPAddress != p.conf.RTPAddress || |
|
|
|
|
newConf.RTCPAddress != p.conf.RTCPAddress || |
|
|
|
|
newConf.RTSPAddress != p.conf.RTSPAddress || |
|
|
|
|
!reflect.DeepEqual(newConf.ProtocolsParsed, p.conf.ProtocolsParsed) || |
|
|
|
|
newConf.RunOnConnect != p.conf.RunOnConnect || |
|
|
|
|
newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart || |
|
|
|
|
closeStats || |
|
|
|
|
closePathMan { |
|
|
|
|
closeServerPlain = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeServerTLS := false |
|
|
|
|
if newConf == nil || |
|
|
|
|
newConf.RTSPDisable != p.conf.RTSPDisable || |
|
|
|
|
newConf.EncryptionParsed != p.conf.EncryptionParsed || |
|
|
|
|
newConf.RTSPSAddress != p.conf.RTSPSAddress || |
|
|
|
|
newConf.ReadTimeout != p.conf.ReadTimeout || |
|
|
|
|
newConf.WriteTimeout != p.conf.WriteTimeout || |
|
|
|
|
newConf.ReadBufferCount != p.conf.ReadBufferCount || |
|
|
|
|
newConf.ServerCert != p.conf.ServerCert || |
|
|
|
|
newConf.ServerKey != p.conf.ServerKey || |
|
|
|
|
newConf.RTSPAddress != p.conf.RTSPAddress || |
|
|
|
|
!reflect.DeepEqual(newConf.ProtocolsParsed, p.conf.ProtocolsParsed) || |
|
|
|
|
newConf.RunOnConnect != p.conf.RunOnConnect || |
|
|
|
|
newConf.RunOnConnectRestart != p.conf.RunOnConnectRestart || |
|
|
|
|
closeStats || |
|
|
|
|
closePathMan { |
|
|
|
|
closeServerTLS = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if closeServerTLS && p.serverRTSPTLS != nil { |
|
|
|
|
p.serverRTSPTLS.Close() |
|
|
|
|
p.serverRTSPTLS = nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if closeServerPlain && p.serverRTSPPlain != nil { |
|
|
|
|
p.serverRTSPPlain.Close() |
|
|
|
|
p.serverRTSPPlain = nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if closeClientMan && p.clientMan != nil { |
|
|
|
|
@ -417,16 +453,6 @@ func (p *program) closeResources(newConf *conf.Conf) {
@@ -417,16 +453,6 @@ func (p *program) closeResources(newConf *conf.Conf) {
|
|
|
|
|
p.serverRTMP = nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if closeServerTLS && p.serverRTSPTLS != nil { |
|
|
|
|
p.serverRTSPTLS.Close() |
|
|
|
|
p.serverRTSPTLS = nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if closeServerPlain && p.serverRTSPPlain != nil { |
|
|
|
|
p.serverRTSPPlain.Close() |
|
|
|
|
p.serverRTSPPlain = nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if closePPROF && p.pprof != nil { |
|
|
|
|
p.pprof.Close() |
|
|
|
|
p.pprof = nil |
|
|
|
|
|