From cbcf8d479479c04fa69ba54ba79fc1f5ff0ba101 Mon Sep 17 00:00:00 2001 From: Bradley Hilton Date: Fri, 26 Feb 2021 13:23:15 -0600 Subject: [PATCH] Fix the http port used not in sync with what is logged (#766) * Fix the http port used not in sync with what is logged * Actually fix the logging race condition * Move the router logging to the router package --- core/core.go | 4 +--- main.go | 10 +++++----- router/router.go | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/core.go b/core/core.go index 6a83913aa..938b83cba 100644 --- a/core/core.go +++ b/core/core.go @@ -72,10 +72,8 @@ func Start() error { // start the rtmp server go rtmp.Start(setStreamAsConnected, setBroadcaster) - port := config.WebServerPort rtmpPort := data.GetRTMPPortNumber() - log.Infof("Web server is listening on port %d, RTMP is accepting inbound streams on port %d.", port, rtmpPort) - log.Infoln("The web admin interface is available at /admin.") + log.Infof("RTMP is accepting inbound streams on port %d.", rtmpPort) return nil } diff --git a/main.go b/main.go index 32ae4b4fa..caaadb010 100644 --- a/main.go +++ b/main.go @@ -103,11 +103,6 @@ func main() { log.Exit(0) } - // starts the core - if err := core.Start(); err != nil { - log.Fatalln("failed to start the core package", err) - } - // Set the web server port if *webServerPortOverride != "" { portNumber, err := strconv.Atoi(*webServerPortOverride) @@ -121,6 +116,11 @@ func main() { config.WebServerPort = data.GetHTTPPortNumber() } + // starts the core + if err := core.Start(); err != nil { + log.Fatalln("failed to start the core package", err) + } + if err := router.Start(); err != nil { log.Fatalln("failed to start/run the router", err) } diff --git a/router/router.go b/router/router.go index 73337414b..2a0816f7a 100644 --- a/router/router.go +++ b/router/router.go @@ -185,7 +185,8 @@ func Start() error { port := config.WebServerPort - log.Tracef("Web server running on port: %d", port) + log.Infof("Web server is listening on port %d.", port) + log.Infoln("The web admin interface is available at /admin.") return http.ListenAndServe(fmt.Sprintf(":%d", port), nil) }