fix TORRENT_DISABLE_EXTENSIONS issues (specifically when enabling it)
This commit is contained in:
parent
4170b3adac
commit
be8c918158
|
@ -48,10 +48,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
class torrent_info;
|
class torrent_info;
|
||||||
#ifdef TORRENT_DISABLE_EXTENSIONS
|
class torrent;
|
||||||
struct torrent;
|
|
||||||
struct torrent_plugin;
|
struct torrent_plugin;
|
||||||
#endif
|
|
||||||
|
|
||||||
// The add_torrent_params is a parameter pack for adding torrents to a session.
|
// The add_torrent_params is a parameter pack for adding torrents to a session.
|
||||||
// The key fields when adding a torrent are:
|
// The key fields when adding a torrent are:
|
||||||
|
|
|
@ -206,11 +206,11 @@ namespace libtorrent
|
||||||
void on_allowed_fast(int received);
|
void on_allowed_fast(int received);
|
||||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
void on_holepunch();
|
void on_holepunch();
|
||||||
#endif
|
|
||||||
|
|
||||||
void on_extended(int received);
|
void on_extended(int received);
|
||||||
|
|
||||||
void on_extended_handshake();
|
void on_extended_handshake();
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void (bt_peer_connection::*message_handler)(int received);
|
typedef void (bt_peer_connection::*message_handler)(int received);
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,10 @@ namespace libtorrent
|
||||||
&bt_peer_connection::on_have_none,
|
&bt_peer_connection::on_have_none,
|
||||||
&bt_peer_connection::on_reject_request,
|
&bt_peer_connection::on_reject_request,
|
||||||
&bt_peer_connection::on_allowed_fast,
|
&bt_peer_connection::on_allowed_fast,
|
||||||
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
0, 0,
|
0, 0,
|
||||||
&bt_peer_connection::on_extended
|
&bt_peer_connection::on_extended
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +117,8 @@ namespace libtorrent
|
||||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||||
, m_encrypted(false)
|
, m_encrypted(false)
|
||||||
, m_rc4_encrypted(false)
|
, m_rc4_encrypted(false)
|
||||||
|
#endif
|
||||||
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
, m_upload_only_id(0)
|
, m_upload_only_id(0)
|
||||||
, m_holepunch_id(0)
|
, m_holepunch_id(0)
|
||||||
, m_sync_bytes_read(0)
|
, m_sync_bytes_read(0)
|
||||||
|
@ -129,7 +133,9 @@ namespace libtorrent
|
||||||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||||
m_in_constructor = false;
|
m_in_constructor = false;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
memset(m_reserved_bits, 0, sizeof(m_reserved_bits));
|
memset(m_reserved_bits, 0, sizeof(m_reserved_bits));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_peer_connection::start()
|
void bt_peer_connection::start()
|
||||||
|
@ -1564,6 +1570,7 @@ namespace libtorrent
|
||||||
// --------- EXTENDED ----------
|
// --------- EXTENDED ----------
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
void bt_peer_connection::on_extended(int received)
|
void bt_peer_connection::on_extended(int received)
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
@ -1664,7 +1671,6 @@ namespace libtorrent
|
||||||
, extended_id, packet_size());
|
, extended_id, packet_size());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
|
||||||
for (extension_list_t::iterator i = m_extensions.begin()
|
for (extension_list_t::iterator i = m_extensions.begin()
|
||||||
, end(m_extensions.end()); i != end; ++i)
|
, end(m_extensions.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
|
@ -1672,7 +1678,6 @@ namespace libtorrent
|
||||||
, recv_buffer))
|
, recv_buffer))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
disconnect(errors::invalid_message, 2);
|
disconnect(errors::invalid_message, 2);
|
||||||
return;
|
return;
|
||||||
|
@ -1704,7 +1709,6 @@ namespace libtorrent
|
||||||
peer_log("<== EXTENDED HANDSHAKE: %s", print_entry(root).c_str());
|
peer_log("<== EXTENDED HANDSHAKE: %s", print_entry(root).c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
|
||||||
for (extension_list_t::iterator i = m_extensions.begin();
|
for (extension_list_t::iterator i = m_extensions.begin();
|
||||||
!m_extensions.empty() && i != m_extensions.end();)
|
!m_extensions.empty() && i != m_extensions.end();)
|
||||||
{
|
{
|
||||||
|
@ -1724,7 +1728,6 @@ namespace libtorrent
|
||||||
m_holepunch_id = boost::uint8_t(m->dict_find_int_value("ut_holepunch", 0));
|
m_holepunch_id = boost::uint8_t(m->dict_find_int_value("ut_holepunch", 0));
|
||||||
m_dont_have_id = boost::uint8_t(m->dict_find_int_value("lt_donthave", 0));
|
m_dont_have_id = boost::uint8_t(m->dict_find_int_value("lt_donthave", 0));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// there is supposed to be a remote listen port
|
// there is supposed to be a remote listen port
|
||||||
int listen_port = int(root.dict_find_int_value("p"));
|
int listen_port = int(root.dict_find_int_value("p"));
|
||||||
|
@ -1788,6 +1791,7 @@ namespace libtorrent
|
||||||
&& !t->share_mode())
|
&& !t->share_mode())
|
||||||
disconnect(errors::upload_upload_connection);
|
disconnect(errors::upload_upload_connection);
|
||||||
}
|
}
|
||||||
|
#endif // TORRENT_DISABLE_EXTENSIONS
|
||||||
|
|
||||||
bool bt_peer_connection::dispatch_message(int received)
|
bool bt_peer_connection::dispatch_message(int received)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue