diff --git a/README.md b/README.md index f828896..1730560 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ The daemon should work on all Ubuntu starting from 18.04 onward, it's possible t cd daemon ./aes67-daemon -c daemon.conf -* use the daemon option _-a_ if you want to bind the daemon HTTP server to another addrress. For example _-a 0.0.0.0_ to bind the daemon HTTP server to all the local network interfaces. +* use the daemon option _-a_ if you want to bind the daemon HTTP server to another address. For example _-a 0.0.0.0_ to bind the daemon HTTP server to all the local network interfaces. * open a browser and load the daemon configuration WebUI at http://[your_ip]:8080 * on the WebUI use the Browser tab to see the other ASE67 Sources advertised on the network. * on the WebUI use the Sinks tab to create a receiver by specifying a remote Source manually or by selecting one of the remote Source discovered (check the Use SDP option to enable this). diff --git a/daemon/config.hpp b/daemon/config.hpp index 2d2d725..abff5a1 100644 --- a/daemon/config.hpp +++ b/daemon/config.hpp @@ -71,7 +71,7 @@ class Config { } void set_http_addr_str(std::string_view http_addr_str) { - http_addr_str_ = http_addr_str; + http_addr_str_ = http_addr_str; }; void set_http_port(uint16_t http_port) { http_port_ = http_port; }; void set_rtsp_port(uint16_t rtsp_port) { rtsp_port_ = rtsp_port; }; diff --git a/daemon/http_server.cpp b/daemon/http_server.cpp index 1a33fb4..cdadc41 100644 --- a/daemon/http_server.cpp +++ b/daemon/http_server.cpp @@ -333,19 +333,20 @@ bool HttpServer::init() { } }); + std::string http_addr = config_->get_http_addr_str(); + if (http_addr.empty()) + http_addr = config_->get_ip_addr_str(); + BOOST_LOG_TRIVIAL(info) << "http_server:: binding to " << http_addr << ":" + << config_->get_http_port(); + /* start http server on a separate thread */ - auto http_addr=config_->get_http_addr_str(); - if(http_addr.empty()) - http_addr=config_->get_ip_addr_str(); - res_ = std::async(std::launch::async, [&]() { try { - svr_.listen(http_addr.c_str(), config_->get_http_port()); + svr_.listen(http_addr.c_str(), config_->get_http_port()); } catch (...) { - BOOST_LOG_TRIVIAL(fatal) - << "http_server:: " - << "failed to listen to " << http_addr << ":" - << config_->get_http_port(); + BOOST_LOG_TRIVIAL(fatal) << "http_server:: " + << "failed to listen to " << http_addr << ":" + << config_->get_http_port(); return false; } return true; diff --git a/daemon/main.cpp b/daemon/main.cpp index 7cbdf6b..45244b6 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -127,7 +127,9 @@ int main(int argc, char* argv[]) { return EXIT_FAILURE; } - config->set_http_addr_str(vm["http_addr"].as()); + if (vm.count("http_addr")) { + config->set_http_addr_str(vm["http_addr"].as()); + } /* override configuration according to command line args */ if (vm.count("http_port")) { config->set_http_port(vm["http_port"].as());