Handle old-style MCU configuration with type but no url.

In the past this disabled the MCU but now was triggering an error due to an
invalid (empty) URL. Keep old behaviour and disable MCU again.
This commit is contained in:
Joachim Bauch 2020-10-07 15:00:35 +02:00
parent bef54339e3
commit 52e5978b19
Failed to extract signature
1 changed files with 13 additions and 3 deletions

View File

@ -159,12 +159,16 @@ func main() {
if mcuType == "" && mcuUrl != "" {
log.Printf("WARNING: Old-style MCU configuration detected with url but no type, defaulting to type %s", signaling.McuTypeJanus)
mcuType = signaling.McuTypeJanus
} else if mcuType == signaling.McuTypeJanus && mcuUrl == "" {
log.Printf("WARNING: Old-style MCU configuration detected with type but no url, disabling")
mcuType = ""
}
if mcuType != "" {
var mcu signaling.Mcu
mcuRetry := initialMcuRetry
mcuRetryTimer := time.NewTimer(mcuRetry)
mcuTypeLoop:
for {
switch mcuType {
case signaling.McuTypeJanus:
@ -201,6 +205,10 @@ func main() {
if mcuType == "" && mcuUrl != "" {
log.Printf("WARNING: Old-style MCU configuration detected with url but no type, defaulting to type %s", signaling.McuTypeJanus)
mcuType = signaling.McuTypeJanus
} else if mcuType == signaling.McuTypeJanus && mcuUrl == "" {
log.Printf("WARNING: Old-style MCU configuration detected with type but no url, disabling")
mcuType = ""
break mcuTypeLoop
}
}
}
@ -212,10 +220,12 @@ func main() {
}
}
}
defer mcu.Stop()
if mcu != nil {
defer mcu.Stop()
log.Printf("Using %s MCU", mcuType)
hub.SetMcu(mcu)
log.Printf("Using %s MCU", mcuType)
hub.SetMcu(mcu)
}
}
go hub.Run()