add shortcut in async resolver for raw IPs.

This commit is contained in:
arvidn 2015-06-16 23:45:05 -04:00
parent 23f14d3de9
commit 8d408c4c86
3 changed files with 19 additions and 7 deletions

View File

@ -103,6 +103,18 @@ namespace libtorrent
}
}
// special handling for raw IP addresses. There's no need to get in line
// behind actual lookups if we can just resolve it immediately.
error_code ec;
address ip = address::from_string(host.c_str(), ec);
if (!ec)
{
std::vector<address> addresses;
addresses.push_back(ip);
m_ios.post(boost::bind(h, ec, addresses));
return;
}
// the port is ignored
tcp::resolver::query q(host, "80");

View File

@ -6122,10 +6122,6 @@ namespace libtorrent
return;
}
#ifndef TORRENT_DISABLE_LOGGING
debug_log("resolving web seed: %s", web->url.c_str());
#endif
proxy_settings const& ps = m_ses.proxy();
if (ps.type == settings_pack::http
|| ps.type == settings_pack::http_pw)
@ -6149,7 +6145,7 @@ namespace libtorrent
else
{
#ifndef TORRENT_DISABLE_LOGGING
debug_log("resolving web seed: %s", web->url.c_str());
debug_log("resolving web seed: \"%s\" %s", hostname.c_str(), web->url.c_str());
#endif
web->resolving = true;

View File

@ -105,7 +105,6 @@ void test_transfer(lt::session& ses, boost::shared_ptr<torrent_info> torrent_fil
, keepalive ? "yes" : "no");
int proxy_port = 0;
if (proxy)
{
proxy_port = start_proxy(proxy);
@ -382,11 +381,16 @@ int EXPORT run_http_suite(int proxy, char const* protocol, bool test_url_seed
}
*/
{
const int mask = alert::all_categories
& ~(alert::progress_notification
| alert::performance_warning
| alert::stats_notification);
settings_pack pack;
pack.set_int(settings_pack::max_queued_disk_bytes, 256 * 1024);
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:51000");
pack.set_int(settings_pack::max_retry_port_bind, 1000);
pack.set_int(settings_pack::alert_mask, ~(alert::progress_notification | alert::stats_notification));
pack.set_int(settings_pack::alert_mask, mask);
pack.set_bool(settings_pack::enable_lsd, false);
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_bool(settings_pack::enable_upnp, false);