lt sync 2185

This commit is contained in:
Marcos Pinto 2008-04-13 03:24:27 +00:00
parent 4ffe14573f
commit d231aafa9a
4 changed files with 63 additions and 19 deletions

View File

@ -2829,7 +2829,13 @@ namespace libtorrent
m_connection_ticket = ticket;
boost::shared_ptr<torrent> t = m_torrent.lock();
TORRENT_ASSERT(t);
if (!t || m_disconnecting)
{
m_ses.m_half_open.done(m_connection_ticket);
m_connecting = false;
disconnect();
return;
}
m_queued = false;
TORRENT_ASSERT(m_connecting);

View File

@ -1619,6 +1619,54 @@ namespace libtorrent
(*m_ses.m_logger) << time_now_string() << " resolving web seed: " << url << "\n";
#endif
std::string protocol;
std::string auth;
std::string hostname;
int port;
std::string path;
boost::tie(protocol, auth, hostname, port, path)
= parse_url_components(url);
#ifdef TORRENT_USE_OPENSSL
if (protocol != "http" && protocol != "https")
#else
if (protocol != "http")
#endif
{
if (m_ses.m_alerts.should_post(alert::warning))
{
m_ses.m_alerts.post_alert(
url_seed_alert(get_handle(), url, "unknown protocol"));
}
// never try it again
remove_url_seed(url);
return;
}
if (hostname.empty())
{
if (m_ses.m_alerts.should_post(alert::warning))
{
m_ses.m_alerts.post_alert(
url_seed_alert(get_handle(), url, "invalid hostname"));
}
// never try it again
remove_url_seed(url);
return;
}
if (port == 0)
{
if (m_ses.m_alerts.should_post(alert::warning))
{
m_ses.m_alerts.post_alert(
url_seed_alert(get_handle(), url, "invalid port"));
}
// never try it again
remove_url_seed(url);
return;
}
m_resolving_web_seeds.insert(url);
proxy_settings const& ps = m_ses.web_seed_proxy();
if (ps.type == proxy_settings::http
@ -1632,16 +1680,6 @@ namespace libtorrent
}
else
{
std::string protocol;
std::string auth;
std::string hostname;
int port;
std::string path;
boost::tie(protocol, auth, hostname, port, path)
= parse_url_components(url);
// TODO: should auth be used here?
tcp::resolver::query q(hostname, boost::lexical_cast<std::string>(port));
m_host_resolver.async_resolve(q, m_ses.m_strand.wrap(
bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, url

View File

@ -261,12 +261,12 @@ namespace libtorrent
TORRENT_FORWARD_RETURN(is_seed(), false);
}
bool torrent_handle::is_finished() const
{
INVARIANT_CHECK;
TORRENT_FORWARD_RETURN(is_finished(), false);
}
bool torrent_handle::is_finished() const
{
INVARIANT_CHECK;
TORRENT_FORWARD_RETURN(is_finished(), false);
}
bool torrent_handle::is_paused() const
{
INVARIANT_CHECK;

View File

@ -636,6 +636,8 @@ namespace libtorrent
if (!info.find_key("name"))
info["name"] = m_name;
if (m_private) info["private"] = 1;
if (!m_multifile)
{
info["length"] = m_files.front().size;
@ -696,8 +698,6 @@ namespace libtorrent
entry dict;
if (m_private) dict["private"] = 1;
if (!m_urls.empty())
dict["announce"] = m_urls.front().url;