mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
lt sync 2185
This commit is contained in:
parent
ef4ea151f4
commit
2cc8b72e96
5 changed files with 64 additions and 13 deletions
|
@ -306,6 +306,7 @@ namespace libtorrent
|
||||||
bool is_valid() const;
|
bool is_valid() const;
|
||||||
|
|
||||||
bool is_seed() const;
|
bool is_seed() const;
|
||||||
|
bool is_finished() const;
|
||||||
bool is_paused() const;
|
bool is_paused() const;
|
||||||
void pause() const;
|
void pause() const;
|
||||||
void resume() const;
|
void resume() const;
|
||||||
|
|
|
@ -2831,7 +2831,13 @@ namespace libtorrent
|
||||||
|
|
||||||
m_connection_ticket = ticket;
|
m_connection_ticket = ticket;
|
||||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
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;
|
m_queued = false;
|
||||||
TORRENT_ASSERT(m_connecting);
|
TORRENT_ASSERT(m_connecting);
|
||||||
|
|
|
@ -1619,6 +1619,54 @@ namespace libtorrent
|
||||||
(*m_ses.m_logger) << time_now_string() << " resolving web seed: " << url << "\n";
|
(*m_ses.m_logger) << time_now_string() << " resolving web seed: " << url << "\n";
|
||||||
#endif
|
#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);
|
m_resolving_web_seeds.insert(url);
|
||||||
proxy_settings const& ps = m_ses.web_seed_proxy();
|
proxy_settings const& ps = m_ses.web_seed_proxy();
|
||||||
if (ps.type == proxy_settings::http
|
if (ps.type == proxy_settings::http
|
||||||
|
@ -1632,16 +1680,6 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
else
|
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));
|
tcp::resolver::query q(hostname, boost::lexical_cast<std::string>(port));
|
||||||
m_host_resolver.async_resolve(q, m_ses.m_strand.wrap(
|
m_host_resolver.async_resolve(q, m_ses.m_strand.wrap(
|
||||||
bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, url
|
bind(&torrent::on_name_lookup, shared_from_this(), _1, _2, url
|
||||||
|
|
|
@ -261,6 +261,12 @@ namespace libtorrent
|
||||||
TORRENT_FORWARD_RETURN(is_seed(), false);
|
TORRENT_FORWARD_RETURN(is_seed(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool torrent_handle::is_finished() const
|
||||||
|
{
|
||||||
|
INVARIANT_CHECK;
|
||||||
|
TORRENT_FORWARD_RETURN(is_finished(), false);
|
||||||
|
}
|
||||||
|
|
||||||
bool torrent_handle::is_paused() const
|
bool torrent_handle::is_paused() const
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
|
@ -636,6 +636,8 @@ namespace libtorrent
|
||||||
if (!info.find_key("name"))
|
if (!info.find_key("name"))
|
||||||
info["name"] = m_name;
|
info["name"] = m_name;
|
||||||
|
|
||||||
|
if (m_private) info["private"] = 1;
|
||||||
|
|
||||||
if (!m_multifile)
|
if (!m_multifile)
|
||||||
{
|
{
|
||||||
info["length"] = m_files.front().size;
|
info["length"] = m_files.front().size;
|
||||||
|
@ -696,8 +698,6 @@ namespace libtorrent
|
||||||
|
|
||||||
entry dict;
|
entry dict;
|
||||||
|
|
||||||
if (m_private) dict["private"] = 1;
|
|
||||||
|
|
||||||
if (!m_urls.empty())
|
if (!m_urls.empty())
|
||||||
dict["announce"] = m_urls.front().url;
|
dict["announce"] = m_urls.front().url;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue