forked from premiere/premiere-libtorrent
fixed issue where web seed connections might have been disconnected in the constructor (which causes problems)
This commit is contained in:
parent
13967086aa
commit
a6bcb8f8c9
|
@ -97,6 +97,7 @@ namespace libtorrent
|
|||
, tcp::endpoint const& remote
|
||||
, std::string const& url
|
||||
, policy::peer* peerinfo);
|
||||
void start();
|
||||
|
||||
~http_seed_connection();
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ namespace libtorrent
|
|||
, tcp::endpoint const& remote
|
||||
, std::string const& url
|
||||
, policy::peer* peerinfo);
|
||||
void start();
|
||||
|
||||
~web_peer_connection();
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ namespace libtorrent
|
|||
// we want large blocks as well, so
|
||||
// we can request more bytes at once
|
||||
request_large_blocks(true);
|
||||
set_upload_only(true);
|
||||
prefer_whole_pieces(1);
|
||||
|
||||
// we only want left-over bandwidth
|
||||
|
@ -106,6 +105,13 @@ namespace libtorrent
|
|||
m_server_string += m_host;
|
||||
}
|
||||
|
||||
void http_seed_connection::start()
|
||||
{
|
||||
set_upload_only(true);
|
||||
if (is_disconnecting()) return;
|
||||
peer_connection::start();
|
||||
}
|
||||
|
||||
http_seed_connection::~http_seed_connection()
|
||||
{}
|
||||
|
||||
|
|
|
@ -1574,6 +1574,8 @@ namespace libtorrent
|
|||
|
||||
void peer_connection::disconnect_if_redundant()
|
||||
{
|
||||
// we cannot disconnect in a constructor
|
||||
TORRENT_ASSERT(m_in_constructor == false);
|
||||
if (!m_ses.settings().close_redundant_connections) return;
|
||||
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||
|
@ -2283,6 +2285,10 @@ namespace libtorrent
|
|||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||
TORRENT_ASSERT(t);
|
||||
|
||||
// we cannot disconnect in a constructor, and
|
||||
// this function may end up doing that
|
||||
TORRENT_ASSERT(m_in_constructor == false);
|
||||
|
||||
#ifdef TORRENT_VERBOSE_LOGGING
|
||||
(*m_logger) << time_now_string() << " <== HAVE_ALL\n";
|
||||
#endif
|
||||
|
@ -2713,6 +2719,10 @@ namespace libtorrent
|
|||
|
||||
void peer_connection::send_not_interested()
|
||||
{
|
||||
// we cannot disconnect in a constructor, and
|
||||
// this function may end up doing that
|
||||
TORRENT_ASSERT(m_in_constructor == false);
|
||||
|
||||
if (!m_interesting)
|
||||
{
|
||||
disconnect_if_redundant();
|
||||
|
|
|
@ -73,7 +73,6 @@ namespace libtorrent
|
|||
// we want large blocks as well, so
|
||||
// we can request more bytes at once
|
||||
request_large_blocks(true);
|
||||
set_upload_only(true);
|
||||
|
||||
// we only want left-over bandwidth
|
||||
set_priority(1);
|
||||
|
@ -110,6 +109,13 @@ namespace libtorrent
|
|||
m_server_string += m_host;
|
||||
}
|
||||
|
||||
void web_peer_connection::start()
|
||||
{
|
||||
set_upload_only(true);
|
||||
if (is_disconnecting()) return;
|
||||
peer_connection::start();
|
||||
}
|
||||
|
||||
web_peer_connection::~web_peer_connection()
|
||||
{}
|
||||
|
||||
|
|
Loading…
Reference in New Issue