Merge pull request #453 from arvidn/support-null-listen-interface-1.1

support NULL being passed as the listen interface to session constructor
This commit is contained in:
Arvid Norberg 2016-02-03 08:13:27 -05:00
commit 38c1b1d932
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");