stub out disabled functions rather than removing them
This commit is contained in:
parent
825fd22c1e
commit
d911ed456a
|
@ -58,10 +58,8 @@ struct TORRENT_EXPORT peer_connection_handle
|
||||||
|
|
||||||
int type() const;
|
int type() const;
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
|
||||||
void add_extension(boost::shared_ptr<peer_plugin>);
|
void add_extension(boost::shared_ptr<peer_plugin>);
|
||||||
peer_plugin const* find_plugin(char const* type);
|
peer_plugin const* find_plugin(char const* type);
|
||||||
#endif
|
|
||||||
|
|
||||||
bool is_seed() const;
|
bool is_seed() const;
|
||||||
|
|
||||||
|
@ -96,10 +94,8 @@ struct TORRENT_EXPORT peer_connection_handle
|
||||||
|
|
||||||
bool failed() const;
|
bool failed() const;
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
|
||||||
void peer_log(peer_log_alert::direction_t direction
|
void peer_log(peer_log_alert::direction_t direction
|
||||||
, char const* event, char const* fmt = "", ...) const TORRENT_FORMAT(4,5);
|
, char const* event, char const* fmt = "", ...) const TORRENT_FORMAT(4,5);
|
||||||
#endif
|
|
||||||
|
|
||||||
bool can_disconnect(error_code const& ec) const;
|
bool can_disconnect(error_code const& ec) const;
|
||||||
|
|
||||||
|
@ -130,12 +126,10 @@ struct TORRENT_EXPORT bt_peer_connection_handle : public peer_connection_handle
|
||||||
bool packet_finished() const;
|
bool packet_finished() const;
|
||||||
bool support_extensions() const;
|
bool support_extensions() const;
|
||||||
|
|
||||||
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
|
|
||||||
bool supports_encryption() const;
|
bool supports_encryption() const;
|
||||||
|
|
||||||
void switch_send_crypto(boost::shared_ptr<crypto_plugin> crypto);
|
void switch_send_crypto(boost::shared_ptr<crypto_plugin> crypto);
|
||||||
void switch_recv_crypto(boost::shared_ptr<crypto_plugin> crypto);
|
void switch_recv_crypto(boost::shared_ptr<crypto_plugin> crypto);
|
||||||
#endif
|
|
||||||
|
|
||||||
boost::shared_ptr<bt_peer_connection> native_handle() const;
|
boost::shared_ptr<bt_peer_connection> native_handle() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,21 +48,25 @@ int peer_connection_handle::type() const
|
||||||
return pc->type();
|
return pc->type();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
|
||||||
void peer_connection_handle::add_extension(boost::shared_ptr<peer_plugin> ext)
|
void peer_connection_handle::add_extension(boost::shared_ptr<peer_plugin> ext)
|
||||||
{
|
{
|
||||||
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
boost::shared_ptr<peer_connection> pc = native_handle();
|
boost::shared_ptr<peer_connection> pc = native_handle();
|
||||||
TORRENT_ASSERT(pc);
|
TORRENT_ASSERT(pc);
|
||||||
pc->add_extension(ext);
|
pc->add_extension(ext);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
peer_plugin const* peer_connection_handle::find_plugin(char const* type)
|
peer_plugin const* peer_connection_handle::find_plugin(char const* type)
|
||||||
{
|
{
|
||||||
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
boost::shared_ptr<peer_connection> pc = native_handle();
|
boost::shared_ptr<peer_connection> pc = native_handle();
|
||||||
TORRENT_ASSERT(pc);
|
TORRENT_ASSERT(pc);
|
||||||
return pc->find_plugin(type);
|
return pc->find_plugin(type);
|
||||||
}
|
#else
|
||||||
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool peer_connection_handle::is_seed() const
|
bool peer_connection_handle::is_seed() const
|
||||||
{
|
{
|
||||||
|
@ -213,18 +217,18 @@ bool peer_connection_handle::failed() const
|
||||||
return pc->failed();
|
return pc->failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
|
||||||
void peer_connection_handle::peer_log(peer_log_alert::direction_t direction
|
void peer_connection_handle::peer_log(peer_log_alert::direction_t direction
|
||||||
, char const* event, char const* fmt, ...) const
|
, char const* event, char const* fmt, ...) const
|
||||||
{
|
{
|
||||||
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
boost::shared_ptr<peer_connection> pc = native_handle();
|
boost::shared_ptr<peer_connection> pc = native_handle();
|
||||||
TORRENT_ASSERT(pc);
|
TORRENT_ASSERT(pc);
|
||||||
va_list v;
|
va_list v;
|
||||||
va_start(v, fmt);
|
va_start(v, fmt);
|
||||||
pc->peer_log(direction, event, fmt, v);
|
pc->peer_log(direction, event, fmt, v);
|
||||||
va_end(v);
|
va_end(v);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool peer_connection_handle::can_disconnect(error_code const& ec) const
|
bool peer_connection_handle::can_disconnect(error_code const& ec) const
|
||||||
{
|
{
|
||||||
|
@ -282,28 +286,34 @@ bool bt_peer_connection_handle::support_extensions() const
|
||||||
return pc->support_extensions();
|
return pc->support_extensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
|
|
||||||
bool bt_peer_connection_handle::supports_encryption() const
|
bool bt_peer_connection_handle::supports_encryption() const
|
||||||
{
|
{
|
||||||
|
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
|
||||||
boost::shared_ptr<bt_peer_connection> pc = native_handle();
|
boost::shared_ptr<bt_peer_connection> pc = native_handle();
|
||||||
TORRENT_ASSERT(pc);
|
TORRENT_ASSERT(pc);
|
||||||
return pc->supports_encryption();
|
return pc->supports_encryption();
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_peer_connection_handle::switch_send_crypto(boost::shared_ptr<crypto_plugin> crypto)
|
void bt_peer_connection_handle::switch_send_crypto(boost::shared_ptr<crypto_plugin> crypto)
|
||||||
{
|
{
|
||||||
|
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
|
||||||
boost::shared_ptr<bt_peer_connection> pc = native_handle();
|
boost::shared_ptr<bt_peer_connection> pc = native_handle();
|
||||||
TORRENT_ASSERT(pc);
|
TORRENT_ASSERT(pc);
|
||||||
pc->switch_send_crypto(crypto);
|
pc->switch_send_crypto(crypto);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void bt_peer_connection_handle::switch_recv_crypto(boost::shared_ptr<crypto_plugin> crypto)
|
void bt_peer_connection_handle::switch_recv_crypto(boost::shared_ptr<crypto_plugin> crypto)
|
||||||
{
|
{
|
||||||
|
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
|
||||||
boost::shared_ptr<bt_peer_connection> pc = native_handle();
|
boost::shared_ptr<bt_peer_connection> pc = native_handle();
|
||||||
TORRENT_ASSERT(pc);
|
TORRENT_ASSERT(pc);
|
||||||
pc->switch_recv_crypto(crypto);
|
pc->switch_recv_crypto(crypto);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
boost::shared_ptr<bt_peer_connection> bt_peer_connection_handle::native_handle() const
|
boost::shared_ptr<bt_peer_connection> bt_peer_connection_handle::native_handle() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue