support NULL being passed as the listen interface to session constructor

This commit is contained in:
arvidn 2016-02-02 23:17:51 -05:00
parent 14387f52a4
commit b0cc0f84ab
3 changed files with 7 additions and 2 deletions

View File

@ -239,6 +239,8 @@ namespace libtorrent
pack.set_int(settings_pack::max_retry_port_bind, listen_port_range.second - listen_port_range.first);
pack.set_str(settings_pack::peer_fingerprint, print.to_string());
char if_string[100];
if (listen_interface == NULL) listen_interface = "0.0.0.0";
snprintf(if_string, sizeof(if_string), "%s:%d", listen_interface, listen_port_range.first);
pack.set_str(settings_pack::listen_interfaces, if_string);

View File

@ -355,7 +355,7 @@ namespace libtorrent
::_set_se_translator(straight_to_debugger);
#endif
bool internal_executor = ios == NULL;
bool const internal_executor = ios == NULL;
if (internal_executor)
{

View File

@ -464,7 +464,10 @@ namespace aux {
// post it to the io_service?
void session_impl::start_session(settings_pack const& pack)
{
m_alerts.set_alert_mask(pack.get_int(settings_pack::alert_mask));
if (pack.has_val(settings_pack::alert_mask))
{
m_alerts.set_alert_mask(pack.get_int(settings_pack::alert_mask));
}
#ifndef TORRENT_DISABLE_LOGGING
session_log("start session");