Skip to content

Commit

Permalink
Fix to avoid crash when option -a is not provided plus cosmetic changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bondagit committed Mar 23, 2024
1 parent f05f40c commit 45a39a4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion daemon/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
Expand Down
19 changes: 10 additions & 9 deletions daemon/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion daemon/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ int main(int argc, char* argv[]) {
return EXIT_FAILURE;
}

config->set_http_addr_str(vm["http_addr"].as<std::string>());
if (vm.count("http_addr")) {
config->set_http_addr_str(vm["http_addr"].as<std::string>());
}
/* override configuration according to command line args */
if (vm.count("http_port")) {
config->set_http_port(vm["http_port"].as<int>());
Expand Down

0 comments on commit 45a39a4

Please sign in to comment.