fix build with no extensions support

This commit is contained in:
Arvid Norberg 2011-01-29 12:13:49 +00:00
parent 87dfdd4790
commit 0c16163e71
12 changed files with 33 additions and 9 deletions

View File

@ -170,13 +170,12 @@ namespace libtorrent
virtual void get_specific_peer_info(peer_info& p) const;
virtual bool in_handshake() const;
bool supports_holepunch() const { return m_holepunch_id != 0; }
void write_holepunch_msg(int type, tcp::endpoint const& ep, int error);
#ifndef TORRENT_DISABLE_EXTENSIONS
bool support_extensions() const { return m_supports_extensions; }
bool supports_holepunch() const { return m_holepunch_id != 0; }
#endif
bool support_extensions() const { return m_supports_extensions; }
// the message handlers are called
// each time a recv() returns some new
// data, the last time it will be called
@ -205,7 +204,9 @@ namespace libtorrent
void on_have_none(int received);
void on_reject_request(int received);
void on_allowed_fast(int received);
#ifndef TORRENT_DISABLE_ENCRYPTION
void on_holepunch();
#endif
void on_extended(int received);
@ -229,6 +230,7 @@ namespace libtorrent
void write_extensions();
void write_upload_only();
void write_share_mode();
void write_holepunch_msg(int type, tcp::endpoint const& ep, int error);
#endif
void write_metadata(std::pair<int, int> req);
void write_metadata_request(std::pair<int, int> req);
@ -397,11 +399,11 @@ private:
int m_share_mode_id;
char m_reserved_bits[8];
#endif
// this is set to true if the handshake from
// the peer indicated that it supports the
// extension protocol
bool m_supports_extensions:1;
#endif
bool m_supports_dht_port:1;
bool m_supports_fast:1;

View File

@ -64,7 +64,6 @@ namespace libtorrent
namespace aux
{
struct session_impl;
struct checker_impl;
}
struct torrent_plugin;

View File

@ -1439,6 +1439,7 @@ namespace libtorrent
// -------- RENDEZVOUS ---------
// -----------------------------
#ifndef TORRENT_DISABLE_EXTENSIONS
void bt_peer_connection::on_holepunch()
{
INVARIANT_CHECK;
@ -1622,6 +1623,7 @@ namespace libtorrent
send_buffer(buf, ptr - buf);
}
#endif // TORRENT_DISABLE_EXTENSIONS
// -----------------------------
// --------- EXTENDED ----------
@ -1749,7 +1751,6 @@ namespace libtorrent
++i;
}
if (is_disconnecting()) return;
#endif
// upload_only
if (lazy_entry const* m = root.dict_find_dict("m"))
@ -1757,6 +1758,7 @@ namespace libtorrent
m_upload_only_id = m->dict_find_int_value("upload_only", 0);
m_holepunch_id = m->dict_find_int_value("ut_holepunch", 0);
}
#endif
// there is supposed to be a remote listen port
int listen_port = root.dict_find_int_value("p");
@ -3013,7 +3015,7 @@ namespace libtorrent
, (recv_buffer[5] & 0x10) ? "extension " : "");
#endif
#ifndef DISABLE_EXTENSIONS
#ifndef TORRENT_DISABLE_EXTENSIONS
std::memcpy(m_reserved_bits, recv_buffer.begin, 8);
if ((recv_buffer[5] & 0x10))
m_supports_extensions = true;

View File

@ -49,7 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/entry.hpp"
#include "libtorrent/peer_request.hpp"
#if TORRENT_USE_IOSTREAM
#if TORRENT_USE_IOSTREAM && !defined TORRENT_DISABLE_EXTENSIONS
#include <fstream>
#include "libtorrent/file.hpp"

View File

@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/pch.hpp"
#ifndef TORRENT_DISABLE_EXTENSIONS
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
@ -348,4 +350,5 @@ namespace libtorrent
}
#endif

View File

@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/pch.hpp"
#ifndef TORRENT_DISABLE_EXTENSIONS
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
@ -589,4 +591,5 @@ namespace libtorrent
}
#endif

View File

@ -3274,6 +3274,7 @@ namespace libtorrent
if (m_holepunch_mode)
fast_reconnect(true);
#ifndef TORRENT_DISABLE_EXTENSIONS
if ((!m_socket->get<utp_stream>() || !m_ses.m_settings.enable_outgoing_tcp)
&& m_peer_info
&& m_peer_info->supports_holepunch
@ -3285,6 +3286,7 @@ namespace libtorrent
if (p)
p->write_holepunch_msg(bt_peer_connection::hp_rendezvous, remote(), 0);
}
#endif
disconnect(e, 1);
return;

View File

@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/pch.hpp"
#ifndef TORRENT_DISABLE_EXTENSIONS
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
@ -313,4 +315,5 @@ namespace libtorrent
}
#endif

View File

@ -315,8 +315,10 @@ namespace libtorrent
return ret;
}
#ifndef TORRENT_DISABLE_EXTENSIONS
// defined in ut_pex.cpp
bool was_introduced_by(peer_plugin const*, tcp::endpoint const&);
#endif
torrent::torrent(
session_impl& ses

View File

@ -328,6 +328,7 @@ namespace libtorrent
TORRENT_ASYNC_CALL2(rename_file, index, new_name);
}
#ifndef TORRENT_DISABLE_EXTENSIONS
void torrent_handle::add_extension(
boost::function<boost::shared_ptr<torrent_plugin>(torrent*, void*)> const& ext
, void* userdata)
@ -335,6 +336,7 @@ namespace libtorrent
INVARIANT_CHECK;
TORRENT_ASYNC_CALL2(add_extension, ext, userdata);
}
#endif
bool torrent_handle::set_metadata(char const* metadata, int size) const
{

View File

@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/pch.hpp"
#ifndef TORRENT_DISABLE_EXTENSIONS
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
@ -538,4 +540,5 @@ namespace libtorrent
}
#endif

View File

@ -32,6 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/pch.hpp"
#ifndef TORRENT_DISABLE_EXTENSIONS
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
@ -582,4 +584,5 @@ namespace libtorrent
}
}
#endif