inversed TORRENT_LOGGING build config to enable logging by default. It's now disabled by TORRENT_DISABLE_LOGGING

This commit is contained in:
Arvid Norberg 2015-04-17 01:15:33 +00:00
parent a4d99188ba
commit 1faf2e201f
34 changed files with 548 additions and 587 deletions

View File

@ -190,8 +190,8 @@ else()
list(APPEND sources sha1)
endif (encryption)
if (logging)
add_definitions(-DTORRENT_LOGGING)
if (NOT logging)
add_definitions(-DTORRENT_DISABLE_LOGGING)
endif()
foreach(s ${sources})

View File

@ -1,3 +1,4 @@
* enable logging build config by default (but alert mask disabled by default)
* deprecated RSS API
* experimental support for BEP 38, "mutable torrents"
* replaced lazy_bdecode with a new bdecoder that's a lot more efficient

View File

@ -393,8 +393,8 @@ feature.compose <disk-stats>on : <define>TORRENT_DISK_STATS ;
feature simulate-slow-read : off on : composite propagated ;
feature.compose <simulate-slow-read>on : <define>TORRENT_SIMULATE_SLOW_READ ;
feature logging : off on : composite propagated link-incompatible ;
feature.compose <logging>on : <define>TORRENT_LOGGING ;
feature logging : on off : composite propagated link-incompatible ;
feature.compose <logging>off : <define>TORRENT_DISABLE_LOGGING ;
feature dht : on off logging : composite propagated link-incompatible ;
feature.compose <dht>off : <define>TORRENT_DISABLE_DHT ;

View File

@ -379,11 +379,11 @@ AC_MSG_CHECKING([whether logging to disk should be enabled])
AS_CASE(["$ARG_ENABLE_LOGGING"],
["yes"|"default"], [
AC_MSG_RESULT([yes])
AC_DEFINE([TORRENT_LOGGING],[1],[Define to enable support for logging alerts])
COMPILETIME_OPTIONS="$COMPILETIME_OPTIONS -DTORRENT_LOGGING "
],
["no"|"none"], [
AC_MSG_RESULT([no])
AC_DEFINE([TORRENT_DISABLE_LOGGING],[1],[Define to enable support for logging alerts])
COMPILETIME_OPTIONS="$COMPILETIME_OPTIONS -DTORRENT_DISABLE_LOGGING "
],
[AC_MSG_RESULT([$ARG_ENABLE_LOGGING])
AC_MSG_ERROR([Unknown option "$ARG_ENABLE_LOGGING". Use either "yes" or "no"])]

View File

@ -249,10 +249,10 @@ Build features:
| | * ``shared`` - links dynamically against the boost |
| | libraries. |
+--------------------------+----------------------------------------------------+
| ``logging`` | * ``off`` - default. logging disabled. |
| | * ``on`` - logging alerts available, still need to |
| | be enabled by the alert mask. The reason logging |
| | is disabled by default is to keep the binary |
| ``logging`` | * ``off`` - logging alerts disabled. |
| | * ``on`` - default. logging alerts available, |
| | still need to be enabled by the alert mask. The |
| | reason to disable logging is to keep the binary |
| | size down. |
+--------------------------+----------------------------------------------------+
| ``dht`` | * ``on`` - build with support for tracker less |
@ -261,12 +261,6 @@ Build features:
| | logging of the DHT protocol traffic. |
| | * ``off`` - build without DHT support. |
+--------------------------+----------------------------------------------------+
| ``need-librt`` | * ``no`` - this platform does not need to link |
| | against librt to have POSIX time functions. |
| | * ``yes`` - specify this if your linux system |
| | requires you to link against librt.a. This is |
| | typically the case on x86 64 bit systems. |
+--------------------------+----------------------------------------------------+
| ``asserts`` | * ``auto`` - asserts are on if in debug mode |
| | * ``on`` - asserts are on, even in release mode |
| | * ``off`` - asserts are disabled |
@ -356,12 +350,6 @@ Build features:
| | API. Generates build errors when deprecated |
| | functions are used. |
+--------------------------+----------------------------------------------------+
| ``full-stats`` | * ``on`` - default, collects stats for IP overhead |
| | and DHT and trackers. This uses a little bit |
| | extra memory for each peer and torrent. |
| | * ``off`` - only collects the standard stats for |
| | upload and download rate. |
+--------------------------+----------------------------------------------------+
| ``iconv`` | * ``auto`` - use iconv for string conversions for |
| | linux and mingw and other posix platforms. |
| | * ``on`` - force use of iconv |
@ -371,20 +359,6 @@ Build features:
| ``i2p`` | * ``on`` - build with I2P support |
| | * ``off`` - build without I2P support |
+--------------------------+----------------------------------------------------+
| ``boost-date-time`` | * ``off`` - don't build asio types that depend |
| | on boost.date_time. libtorrent doesn't use them |
| | but if the client does, you need these to be |
| | built. |
| | * ``on`` - build asio types that depend on |
| | boost.date_time. |
+--------------------------+----------------------------------------------------+
| ``statistics`` | * ``off`` - default. No logging of additional |
| | stats. |
| | * ``on`` - log session statistics in current |
| | working directory session_stats<pid>. The log |
| | is rotated every hour. It can be parsed by the |
| | parse_session_stats.py script (requires gnuplot) |
+--------------------------+----------------------------------------------------+
| ``profile-calls`` | * ``off`` - default. No additional call profiling. |
| | * ``on`` - Enable logging of stack traces of |
| | calls into libtorrent that are blocking. On |
@ -557,9 +531,9 @@ defines you can use to control the build.
| | compilation units having different views of |
| | structs and class layouts and sizes. |
+----------------------------------------+-------------------------------------------------+
| ``TORRENT_LOGGING`` | This macro will enable support for logging |
| ``TORRENT_DISABLE_LOGGING`` | This macro will disable support for logging |
| | alerts, like log_alert, torrent_log_alert and |
| | peer_log_alert. Without this build flag, you |
| | peer_log_alert. With this build flag, you |
| | cannot enable those alerts. |
+----------------------------------------+-------------------------------------------------+
| ``TORRENT_STORAGE_DEBUG`` | This will enable extra expensive invariant |

View File

@ -173,21 +173,21 @@ namespace libtorrent {
rss_notification = 0x1000,
#endif
// Enables debug logging alerts. These are only available when
// libtorrent is built with logging enabled (``TORRENT_LOGGING``).
// The alerts being posted are log_alert and are session wide.
// Enables debug logging alerts. These are available unless libtorrent
// was built with logging disabled (``TORRENT_DISABLE_LOGGING``). The
// alerts being posted are log_alert and are session wide.
session_log_notification = 0x2000,
// Enables debug logging alerts for torrents. These are only available
// when libtorrent is built with logging enabled
// (``TORRENT_LOGGING``). The alerts being posted are
// Enables debug logging alerts for torrents. These are available
// unless libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// torrent_log_alert and are torrent wide debug events.
torrent_log_notification = 0x4000,
// Enables debug logging alerts for peers. These are only available
// when libtorrent is built with logging enabled
// (``TORRENT_LOGGING``). The alerts being posted are peer_log_alert
// and low-level peer events and messages.
// Enables debug logging alerts for peers. These are available unless
// libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// peer_log_alert and low-level peer events and messages.
peer_log_notification = 0x8000,
// The full bitmask, representing all available categories.

View File

@ -2118,9 +2118,7 @@ namespace libtorrent
// This alert is posted by some session wide event. Its main purpose is
// trouble shooting and debugging. It's not enabled by the default alert
// mask and is enabled by the ``alert::session_log_notification`` bit.
// Furhtermore, it's by default disabled as a build configuration. To
// enable, build libtorrent with logging support enabled (``logging=on``
// with bjam or define ``TORRENT_LOGGING``).
// Furhtermore, it's by default disabled as a build configuration.
struct TORRENT_EXPORT log_alert : alert
{
// internal
@ -2142,9 +2140,7 @@ namespace libtorrent
// This alert is posted by torrent wide events. It's meant to be used for
// trouble shooting and debugging. It's not enabled by the default alert
// mask and is enabled by the ``alert::torrent_log_notification`` bit. By
// default it is disabled as a build configuration. To enable, build
// libtorrent with logging support enabled (``logging=on`` with bjam or
// define ``TORRENT_LOGGING``).
// default it is disabled as a build configuration.
struct TORRENT_EXPORT torrent_log_alert : torrent_alert
{
// internal
@ -2166,9 +2162,7 @@ namespace libtorrent
// This alert is posted by events specific to a peer. It's meant to be used
// for trouble shooting and debugging. It's not enabled by the default alert
// mask and is enabled by the ``alert::peer_log_notification`` bit. By
// default it is disabled as a build configuration. To enable, build
// libtorrent with logging support enabled (``logging=on`` with bjam or
// define ``TORRENT_LOGGING``).
// default it is disabled as a build configuration.
struct TORRENT_EXPORT peer_log_alert : peer_alert
{
// internal

View File

@ -152,7 +152,7 @@ namespace libtorrent
struct session_impl;
struct session_settings;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
struct tracker_logger;
#endif
@ -350,7 +350,7 @@ namespace libtorrent
void on_port_map_log(char const* msg, int map_transport);
void on_lsd_announce(error_code const& e);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
void on_lsd_log(char const* log);
#endif
@ -1131,7 +1131,7 @@ namespace libtorrent
// accumulated error
boost::uint16_t m_tick_residual;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
virtual void session_log(char const* fmt, ...) const;
virtual void session_vlog(char const* fmt, va_list& va) const;
@ -1203,7 +1203,7 @@ namespace libtorrent
#endif
};
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
struct tracker_logger : request_callback
{
tracker_logger(session_interface& ses);

View File

@ -46,7 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket.hpp"
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include <boost/shared_ptr.hpp>
#endif
@ -97,13 +97,13 @@ namespace libtorrent
namespace libtorrent { namespace aux
{
#if defined TORRENT_LOGGING || TORRENT_USE_ASSERTS
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
// This is the basic logging and debug interface offered by the session.
// a release build with logging disabled (which is the default) will
// not have this class at all
struct session_logger
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
virtual void session_log(char const* fmt, ...) const = 0;
virtual void session_vlog(char const* fmt, va_list& va) const = 0;
#endif
@ -115,14 +115,14 @@ namespace libtorrent { namespace aux
virtual bool is_posting_torrent_updates() const = 0;
#endif
};
#endif // TORRENT_LOGGING || TORRENT_USE_ASSERTS
#endif // TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
// TOOD: 2 make this interface a lot smaller. It could be split up into
// several smaller interfaces. Each subsystem could then limit the size
// of the mock object to test it.
struct session_interface
: buffer_allocator_interface
#if defined TORRENT_LOGGING || TORRENT_USE_ASSERTS
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
, session_logger
#endif
{

View File

@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include <boost/function/function1.hpp>
#endif
@ -51,7 +51,7 @@ namespace libtorrent
{
typedef boost::function<void(tcp::endpoint, sha1_hash)> peer_callback_t;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
typedef boost::function<void(char const*)> log_callback_t;
#endif
@ -59,7 +59,7 @@ class lsd : public boost::enable_shared_from_this<lsd>
{
public:
lsd(io_service& ios, peer_callback_t const& cb
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
, log_callback_t const& log
#endif
);
@ -89,7 +89,7 @@ private:
#if TORRENT_USE_IPV6
broadcast_socket m_socket6;
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_callback_t m_log_cb;
void debug_log(char const* fmt, ...) const;
#endif

View File

@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include <string>
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/debug.hpp"
#endif
@ -414,7 +414,7 @@ namespace libtorrent
void set_holepunch_mode()
{
m_holepunch_mode = true;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** HOLEPUNCH MODE ***");
#endif
}
@ -550,11 +550,11 @@ namespace libtorrent
void decrease_est_reciprocation_rate();
int est_reciprocation_rate() const { return m_est_reciprocation_rate; }
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
virtual void peer_log(char const* fmt, ...) const;
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
time_point m_connect_time;
time_point m_bitfield_time;
time_point m_unchoke_time;
@ -650,7 +650,7 @@ namespace libtorrent
virtual boost::optional<piece_block_progress>
downloading_piece_progress() const
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** downloading_piece_progress() dispatched to the base class!");
#endif
return boost::optional<piece_block_progress>();

View File

@ -62,7 +62,7 @@ namespace libtorrent
virtual bool failed() const = 0;
virtual stat const& statistics() const = 0;
virtual void get_peer_info(peer_info& p) const = 0;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
virtual void peer_log(char const* fmt, ...) const = 0;
#endif
};

View File

@ -1025,7 +1025,7 @@ namespace libtorrent
time_t last_seen_complete() const { return m_last_seen_complete; }
// LOGGING
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
virtual void debug_log(const char* fmt, ...) const;
void log_to_all_peers(char const* message);
time_point m_dht_start_time;

View File

@ -230,7 +230,7 @@ namespace libtorrent
, const std::string& msg
, int retry_interval) = 0;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
virtual void debug_log(const char* fmt, ...) const = 0;
#endif
};
@ -336,7 +336,7 @@ namespace libtorrent
, resolver_interface& resolver
, struct ip_filter& ipf
, aux::session_settings const& sett
#if defined TORRENT_LOGGING || TORRENT_USE_ASSERTS
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
, aux::session_logger& ses
#endif
);
@ -392,7 +392,7 @@ namespace libtorrent
resolver_interface& m_host_resolver;
aux::session_settings const& m_settings;
counters& m_stats_counters;
#if defined TORRENT_LOGGING || TORRENT_USE_ASSERTS
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
aux::session_logger& m_ses;
#endif

View File

@ -161,10 +161,6 @@ void utp_send_ack(utp_socket_impl* s);
void utp_socket_drained(utp_socket_impl* s);
void utp_writable(utp_socket_impl* s);
#if defined TORRENT_LOGGING
int socket_impl_size();
#endif
// this is the user-level stream interface to utp sockets.
// the reason why it's split up in a utp_stream class and
// an implementation class is because the socket state has

View File

@ -125,7 +125,7 @@ namespace libtorrent
, m_in_constructor(true)
#endif
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** bt_peer_connection");
#endif
@ -173,7 +173,7 @@ namespace libtorrent
if (t->graceful_pause())
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** ON_CONNECTED [ graceful-paused ]");
#endif
disconnect(error_code(errors::torrent_paused), op_bittorrent);
@ -193,7 +193,7 @@ namespace libtorrent
if (is_ssl(*get_socket()))
out_enc_policy = settings_pack::pe_disabled;
#endif
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
char const* policy_name[] = {"forced", "enabled", "disabled"};
peer_log("*** outgoing encryption policy: %s", policy_name[out_enc_policy]);
#endif
@ -254,7 +254,7 @@ namespace libtorrent
void bt_peer_connection::on_metadata()
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** ON_METADATA");
#endif
@ -286,7 +286,7 @@ namespace libtorrent
TORRENT_ASSERT(m_sent_handshake && m_sent_bitfield);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> DHT_PORT [ %d ]", listen_port);
#endif
char msg[] = {0,0,0,3, msg_dht_port, 0, 0};
@ -302,7 +302,7 @@ namespace libtorrent
INVARIANT_CHECK;
TORRENT_ASSERT(m_sent_handshake);
m_sent_bitfield = true;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> HAVE_ALL");
#endif
char msg[] = {0,0,0,1, msg_have_all};
@ -316,7 +316,7 @@ namespace libtorrent
INVARIANT_CHECK;
TORRENT_ASSERT(m_sent_handshake);
m_sent_bitfield = true;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> HAVE_NONE");
#endif
char msg[] = {0,0,0,1, msg_have_none};
@ -333,7 +333,7 @@ namespace libtorrent
if (!m_supports_fast) return;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> REJECT_PIECE [ piece: %d | s: %d | l: %d ]"
, r.piece, r.start, r.length);
#endif
@ -379,7 +379,7 @@ namespace libtorrent
TORRENT_ASSERT(t);
TORRENT_ASSERT(t->valid_metadata());
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> SUGGEST [ piece: %d num_peers: %d ]", piece
, t->has_picker() ? t->picker().get_availability(piece) : -1);
#endif
@ -444,7 +444,7 @@ namespace libtorrent
TORRENT_ASSERT(!m_dh_key_exchange.get());
TORRENT_ASSERT(!m_sent_handshake);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (is_outgoing())
peer_log("*** initiating encrypted handshake");
#endif
@ -458,7 +458,7 @@ namespace libtorrent
int pad_size = random() % 512;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log(" pad size: %d", pad_size);
#endif
@ -472,7 +472,7 @@ namespace libtorrent
std::generate(ptr, ptr + pad_size, random_byte);
send_buffer(msg, buf_size);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log(" sent DH key");
#endif
}
@ -536,7 +536,7 @@ namespace libtorrent
if ((crypto_provide & settings_pack::pe_both) == 0)
crypto_provide = settings_pack::pe_both;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
char const* level[] = {"plaintext", "rc4", "plaintext rc4"};
peer_log(" crypto provide : [ %s ]"
, level[crypto_provide-1]);
@ -576,7 +576,7 @@ namespace libtorrent
else // 0x01
m_rc4_encrypted = false;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log(" crypto select : [ %s ]"
, (crypto_select == 0x01) ? "plaintext" : "rc4");
#endif
@ -654,7 +654,7 @@ namespace libtorrent
m_rc4->set_incoming_key(&remote_key[0], 20);
m_rc4->set_outgoing_key(&local_key[0], 20);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log(" computed RC4 keys");
#endif
}
@ -786,7 +786,7 @@ namespace libtorrent
// we support FAST extension
*(ptr + 7) |= 0x04;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
std::string bitmask;
for (int k = 0; k < 8; ++k)
{
@ -817,7 +817,7 @@ namespace libtorrent
memcpy(ptr, &m_our_peer_id[0], 20);
ptr += 20;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
{
char hex_pid[41];
to_hex((char const*)&m_our_peer_id[0], 20, hex_pid);
@ -900,7 +900,7 @@ namespace libtorrent
{
INVARIANT_CHECK;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== KEEPALIVE");
#endif
incoming_keepalive();
@ -1240,7 +1240,7 @@ namespace libtorrent
if (recv_pos < header_size) return;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
// peer_log("<== PIECE_FRAGMENT p: %d start: %d length: %d"
// , p.piece, p.start, p.length);
#endif
@ -1260,7 +1260,7 @@ namespace libtorrent
if (merkle && list_size > 0)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== HASHPIECE [ piece: %d list: %d ]", p.piece, list_size);
#endif
bdecode_node hash_list;
@ -1511,7 +1511,7 @@ namespace libtorrent
#endif
else
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
error_code ec;
static const char* hp_msg_name[] = {"rendezvous", "connect", "failed"};
peer_log("<== HOLEPUNCH [ msg: %s from %s to: unknown address type ]"
@ -1529,7 +1529,7 @@ namespace libtorrent
{
case hp_rendezvous: // rendezvous
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== HOLEPUNCH [ msg: rendezvous to: %s ]"
, print_address(ep.address()).c_str());
#endif
@ -1563,7 +1563,7 @@ namespace libtorrent
torrent_peer* p = t->add_peer(ep, peer_info::pex);
if (p == 0 || p->connection)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== HOLEPUNCH [ msg:connect to: %s error: failed to add peer ]"
, print_address(ep.address()).c_str());
#endif
@ -1573,7 +1573,7 @@ namespace libtorrent
}
if (p->banned)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== HOLEPUNCH [ msg:connect to: %s error: peer banned ]"
, print_address(ep.address()).c_str());
#endif
@ -1592,7 +1592,7 @@ namespace libtorrent
t->update_want_peers();
if (p->connection)
p->connection->set_holepunch_mode();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== HOLEPUNCH [ msg:connect to: %s ]"
, print_address(ep.address()).c_str());
#endif
@ -1600,7 +1600,7 @@ namespace libtorrent
case hp_failed:
{
boost::uint32_t error = detail::read_uint32(ptr);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
error_code ec;
char const* err_msg[] = {"no such peer", "not connected", "no support", "no self"};
peer_log("<== HOLEPUNCH [ msg:failed error: %d msg: %s ]", error
@ -1609,7 +1609,7 @@ namespace libtorrent
// #error deal with holepunch errors
(void)error;
} break;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
default:
{
error_code ec;
@ -1629,7 +1629,7 @@ namespace libtorrent
else detail::write_uint8(1, ptr);
detail::write_endpoint(ep, ptr);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
error_code ec;
static const char* hp_msg_name[] = {"rendezvous", "connect", "failed"};
static const char* hp_error_string[] = {"", "no such peer", "not connected", "no support", "no self"};
@ -1700,13 +1700,13 @@ namespace libtorrent
if (!m_recv_buffer.packet_finished()) return;
if (m_recv_buffer.packet_size() != 3)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== UPLOAD_ONLY [ ERROR: unexpected packet size: %d ]", m_recv_buffer.packet_size());
#endif
return;
}
bool ul = detail::read_uint8(recv_buffer.begin) != 0;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== UPLOAD_ONLY [ %s ]", (ul?"true":"false"));
#endif
set_upload_only(ul);
@ -1718,13 +1718,13 @@ namespace libtorrent
if (!m_recv_buffer.packet_finished()) return;
if (m_recv_buffer.packet_size() != 3)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== SHARE_MODE [ ERROR: unexpected packet size: %d ]", m_recv_buffer.packet_size());
#endif
return;
}
bool sm = detail::read_uint8(recv_buffer.begin) != 0;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== SHARE_MODE [ %s ]", (sm?"true":"false"));
#endif
set_share_mode(sm);
@ -1734,7 +1734,7 @@ namespace libtorrent
if (extended_id == holepunch_msg)
{
if (!m_recv_buffer.packet_finished()) return;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== HOLEPUNCH");
#endif
on_holepunch();
@ -1746,7 +1746,7 @@ namespace libtorrent
if (!m_recv_buffer.packet_finished()) return;
if (m_recv_buffer.packet_size() != 6)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== DONT_HAVE [ ERROR: unexpected packet size: %d ]", m_recv_buffer.packet_size());
#endif
return;
@ -1756,7 +1756,7 @@ namespace libtorrent
return;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (m_recv_buffer.packet_finished())
peer_log("<== EXTENSION MESSAGE [ msg: %d size: %d ]"
, extended_id, m_recv_buffer.packet_size());
@ -1789,14 +1789,14 @@ namespace libtorrent
int ret = bdecode(recv_buffer.begin + 2, recv_buffer.end, root, ec, &pos);
if (ret != 0 || ec || root.type() != bdecode_node::dict_t)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** invalid extended handshake: %s pos: %d"
, ec.message().c_str(), pos);
#endif
return;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== EXTENDED HANDSHAKE: %s", print_entry(root).c_str());
#endif
@ -1981,7 +1981,7 @@ namespace libtorrent
// connections, don't sent upload-only
if (!m_settings.get_bool(settings_pack::close_redundant_connections)) return;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> UPLOAD_ONLY [ %d ]"
, int(t->is_upload_only() && !t->super_seeding()));
#endif
@ -2082,7 +2082,7 @@ namespace libtorrent
if (t->super_seeding())
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log(" *** NOT SENDING BITFIELD, super seeding");
#endif
if (m_supports_fast) write_have_none();
@ -2113,7 +2113,7 @@ namespace libtorrent
else if (t->num_have() == 0)
{
// don't send a bitfield if we don't have any pieces
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log(" *** NOT SENDING BITFIELD");
#endif
m_sent_bitfield = true;
@ -2184,7 +2184,7 @@ namespace libtorrent
, end(t->predictive_pieces().end()); i != end; ++i)
msg[5 + *i / 8] |= (0x80 >> (*i & 7));
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
std::string bitfield_string;
bitfield_string.resize(num_pieces);
@ -2205,7 +2205,7 @@ namespace libtorrent
{
for (int i = 0; i < num_lazy_pieces; ++i)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> HAVE [ piece: %d ]", lazy_pieces[i]);
#endif
write_have(lazy_pieces[i]);
@ -2324,7 +2324,7 @@ namespace libtorrent
stats_counters().inc_stats_counter(counters::num_outgoing_ext_handshake);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> EXTENDED HANDSHAKE: %s", handshake.to_string().c_str());
#endif
}
@ -2538,7 +2538,7 @@ namespace libtorrent
if (!m_enc_handler.is_recv_plaintext())
{
int consumed = m_enc_handler.decrypt(m_recv_buffer, bytes_transferred);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (consumed + bytes_transferred > 0)
peer_log("<== decrypted block [ s = %d ]", consumed + bytes_transferred);
#endif
@ -2610,7 +2610,7 @@ namespace libtorrent
return;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** received DH key");
#endif
@ -2709,7 +2709,7 @@ namespace libtorrent
else
{
std::size_t bytes_processed = syncoffset + 20;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** sync point (hash) found at offset %d"
, m_sync_bytes_read + bytes_processed - 20);
#endif
@ -2758,7 +2758,7 @@ namespace libtorrent
}
init_pe_rc4_handler(m_dh_key_exchange->get_secret(), ti->info_hash());
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** stream key found, torrent located");
#endif
}
@ -2781,7 +2781,7 @@ namespace libtorrent
return;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** verification constant found");
#endif
m_state = read_pe_cryptofield;
@ -2845,7 +2845,7 @@ namespace libtorrent
else
{
std::size_t bytes_processed = syncoffset + 8;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** sync point (verification constant) found at offset %d"
, m_sync_bytes_read + bytes_processed - 8);
#endif
@ -2880,7 +2880,7 @@ namespace libtorrent
boost::uint32_t crypto_field = detail::read_uint32(recv_buffer.begin);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** crypto %s : [%s%s ]"
, is_outgoing() ? "select" : "provide"
, (crypto_field & 1) ? " plaintext" : ""
@ -2994,7 +2994,7 @@ namespace libtorrent
return;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** len(IA) : %d", len_ia);
#endif
if (len_ia == 0)
@ -3040,7 +3040,7 @@ namespace libtorrent
buffer::interval wr_buf = m_recv_buffer.mutable_buffer();
rc4_decrypt(wr_buf.begin, m_recv_buffer.packet_size());
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** decrypted ia : %d bytes", m_recv_buffer.packet_size());
#endif
@ -3089,7 +3089,7 @@ namespace libtorrent
wr_buf.begin += m_recv_buffer.packet_size();
rc4_decrypt(wr_buf.begin, wr_buf.left());
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** decrypted remaining %d bytes", wr_buf.left());
#endif
}
@ -3130,14 +3130,14 @@ namespace libtorrent
memcmp(recv_buffer.begin, protocol_string, 20) != 0)
{
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** unrecognized protocol header");
#endif
#ifdef TORRENT_USE_OPENSSL
if (is_ssl(*get_socket()))
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** SSL peers are not allowed to use any other encryption");
#endif
disconnect(errors::invalid_info_hash, op_bittorrent, 1);
@ -3163,7 +3163,7 @@ namespace libtorrent
return;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** attempting encrypted connection");
#endif
m_state = read_pe_dhkey;
@ -3191,7 +3191,7 @@ namespace libtorrent
}
#endif
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== BitTorrent protocol");
#endif
}
@ -3211,7 +3211,7 @@ namespace libtorrent
recv_buffer = m_recv_buffer.get();
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
std::string extensions;
extensions.resize(8 * 8);
for (int i=0; i < 8; ++i)
@ -3267,14 +3267,14 @@ namespace libtorrent
if (!std::equal(recv_buffer.begin + 8, recv_buffer.begin + 28
, (const char*)t->torrent_file().info_hash().begin()))
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** received invalid info_hash");
#endif
disconnect(errors::invalid_info_hash, op_bittorrent, 1);
return;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<<< info_hash received");
#endif
}
@ -3310,7 +3310,7 @@ namespace libtorrent
if (!m_recv_buffer.packet_finished()) return;
recv_buffer = m_recv_buffer.get();
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
{
char hex_pid[41];
to_hex(recv_buffer.begin, 20, hex_pid);
@ -3392,7 +3392,7 @@ namespace libtorrent
if (m_supports_extensions) write_extensions();
#endif
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== HANDSHAKE");
#endif
// consider this a successful connection, reset the failcount
@ -3508,7 +3508,7 @@ namespace libtorrent
int bt_peer_connection::hit_send_barrier(std::vector<asio::mutable_buffer>& iovec)
{
int next_barrier = m_enc_handler.encrypt(iovec);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (next_barrier != 0)
peer_log("==> encrypted block [ s = %d ]", next_barrier);
#endif

View File

@ -78,7 +78,7 @@ namespace libtorrent
prefer_contiguous_blocks(blocks_per_piece);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** http_seed_connection");
#endif
}
@ -194,7 +194,7 @@ namespace libtorrent
request += "\r\n\r\n";
m_first_request = false;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> %s", request.c_str());
#endif
@ -213,7 +213,7 @@ namespace libtorrent
if (error)
{
received_bytes(0, bytes_transferred);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** http_seed_connection error: %s", error.message().c_str());
#endif
return;
@ -375,7 +375,7 @@ namespace libtorrent
}
else
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** parsed chunk: %d header_size: %d", chunk_size, header_size);
#endif
TORRENT_ASSERT(bytes_transferred >= size_t(header_size - m_partial_chunk_header));
@ -413,7 +413,7 @@ namespace libtorrent
int retry_time = atol(std::string(recv_buffer.begin, recv_buffer.end).c_str());
if (retry_time <= 0) retry_time = 60;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** retrying in %d seconds", retry_time);
#endif

View File

@ -232,7 +232,7 @@ namespace libtorrent
// the url + 100 estimated header size
sent_bytes(url.size() + 100);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> cb = requester();
if (cb)
@ -266,7 +266,7 @@ namespace libtorrent
++i;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> cb = requester();
if (cb)
{

View File

@ -66,7 +66,7 @@ namespace libtorrent
static error_code ec;
lsd::lsd(io_service& ios, peer_callback_t const& cb
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
, log_callback_t const& log
#endif
)
@ -75,7 +75,7 @@ lsd::lsd(io_service& ios, peer_callback_t const& cb
#if TORRENT_USE_IPV6
, m_socket6(udp::endpoint(address_v6::from_string("ff15::efc0:988f", ec), 6771))
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
, m_log_cb(log)
#endif
, m_broadcast_timer(ios)
@ -87,7 +87,7 @@ lsd::lsd(io_service& ios, peer_callback_t const& cb
{
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
void lsd::debug_log(char const* fmt, ...) const
{
va_list v;
@ -144,7 +144,7 @@ void lsd::announce_impl(sha1_hash const& ih, int listen_port, bool broadcast
to_hex((char const*)&ih[0], 20, ih_hex);
char msg[200];
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("==> LSD: ih: %s port: %u\n", ih_hex, listen_port);
#endif
@ -157,7 +157,7 @@ void lsd::announce_impl(sha1_hash const& ih, int listen_port, bool broadcast
if (ec)
{
m_disabled = true;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** LSD: failed to send message: (%d) %s", ec.value()
, ec.message().c_str());
#endif
@ -173,7 +173,7 @@ void lsd::announce_impl(sha1_hash const& ih, int listen_port, bool broadcast
if (ec)
{
m_disabled6 = true;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** LSD: failed to send message6: (%d) %s", ec.value()
, ec.message().c_str());
#endif
@ -222,7 +222,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
if (!p.header_finished() || error)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("<== LSD: incomplete HTTP message");
#endif
return;
@ -230,7 +230,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
if (p.method() != "bt-search")
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("<== LSD: invalid HTTP method: %s", p.method().c_str());
#endif
return;
@ -239,7 +239,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
std::string const& port_str = p.header("port");
if (port_str.empty())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("<== LSD: invalid BT-SEARCH, missing port");
#endif
return;
@ -258,7 +258,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
boost::int32_t cookie = strtol(cookie_iter->second.c_str(), NULL, 16);
if (cookie == m_cookie)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("<== LSD: ignoring packet (cookie matched our own): %x == %x"
, cookie, m_cookie);
#endif
@ -274,7 +274,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
std::string const& ih_str = i->second;
if (ih_str.size() != 40)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("<== LSD: invalid BT-SEARCH, invalid infohash: %s"
, ih_str.c_str());
#endif
@ -286,7 +286,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
if (!ih.is_all_zeros() && port != 0)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("<== LSD: %s:%d ih: %s"
, print_address(from.address()).c_str()
, port, ih_str.c_str());

View File

@ -209,7 +209,7 @@ namespace libtorrent { namespace
// invalid tex message
if (added == 0)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log(" <== LT_TEX [ NOT A DICTIONARY ]");
#endif
return true;
@ -217,14 +217,14 @@ namespace libtorrent { namespace
if (m_tp.num_tex_trackers() >= 50)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log(" <== LT_TEX [ we already have %d trackers "
"from tex, don't add any more", m_tp.num_tex_trackers());
#endif
return true;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
std::stringstream log_line;
log_line << aux::time_now_string() << " <== LT_TEX [ "
"added: ";
@ -259,7 +259,7 @@ namespace libtorrent { namespace
if (m_tp.num_tex_trackers() >= 50)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_line << "**reached-limit** ";
#endif
break;
@ -271,11 +271,11 @@ namespace libtorrent { namespace
if (m_torrent.add_tracker(e))
m_tp.increment_tracker_counter();
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_line << e.url << " ";
#endif
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_line << "]\n";
m_pc.peer_log("%s", log_line.str().c_str());
#endif
@ -329,7 +329,7 @@ namespace libtorrent { namespace
if (!m_torrent.valid_metadata() || m_torrent.torrent_file().priv())
return false;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
std::stringstream log_line;
log_line << aux::time_now_string() << " ==> LT_TEX [ "
"added: ";
@ -341,14 +341,14 @@ namespace libtorrent { namespace
{
if (!send_tracker(*i)) continue;
added.push_back(i->url);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_line << i->url << " ";
#endif
}
std::vector<char> tex_msg;
bencode(std::back_inserter(tex_msg), tex);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_line << "]";
m_pc.peer_log("%s", log_line.str().c_str());
#endif

View File

@ -304,7 +304,7 @@ namespace libtorrent { namespace
// abort if the peer doesn't support the metadata extension
if (m_message_index == 0) return;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("==> METADATA_REQUEST [ start: %d | size: %d ]\n"
, start, size);
#endif
@ -342,7 +342,7 @@ namespace libtorrent { namespace
char msg[15];
char* ptr = msg;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("==> METADATA [ start: %d | total_size: %d | offset: %d | data_size: %d ]"
, req.first, req.second, offset.first, offset.second);
#endif
@ -363,7 +363,7 @@ namespace libtorrent { namespace
}
else
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("==> DONT HAVE METADATA\n");
#endif
char msg[4+3];
@ -404,7 +404,7 @@ namespace libtorrent { namespace
int start = detail::read_uint8(body.begin);
int size = detail::read_uint8(body.begin) + 1;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("<== METADATA_REQUEST [ start: %d | size: %d ]\n"
, start, size);
#endif
@ -427,7 +427,7 @@ namespace libtorrent { namespace
int offset = detail::read_int32(body.begin);
int data_size = length - 9;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("<== METADATA [ total_size: %d | offset: %d | data_size: %d ]"
,total_size, offset, data_size);
#endif
@ -470,7 +470,7 @@ namespace libtorrent { namespace
if (m_waiting_metadata_request)
m_tp.cancel_metadata_request(m_last_metadata_request);
m_waiting_metadata_request = false;
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("<== DONT HAVE METADATA\n");
#endif
break;

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket_io.hpp" // for print_endpoint
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/socket_io.hpp" // for print_endpoint
#include "libtorrent/ip_voter.hpp" // for external_ip
#endif
@ -620,7 +620,7 @@ namespace libtorrent
TORRENT_ASSERT(i->connection != &c);
TORRENT_ASSERT(i->address() == c.remote().address());
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
c.peer_log("*** DUPLICATE PEER [ this: \"%s\" that: \"%s\" ]"
, print_address(c.remote().address()).c_str()
, print_address(i->address()).c_str());
@ -678,7 +678,7 @@ namespace libtorrent
if (our_port < other_port)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
c.peer_log("*** DUPLICATE PEER RESOLUTION [ \"%d\" < \"%d\" ]", our_port, other_port);
i->connection->peer_log("*** DUPLICATE PEER RESOLUTION [ \"%d\" < \"%d\" ]", our_port, other_port);
#endif
@ -696,7 +696,7 @@ namespace libtorrent
}
else
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
c.peer_log("*** DUPLICATE PEER RESOLUTION [ \"%d\" >= \"%d\" ]", our_port, other_port);
i->connection->peer_log("*** DUPLICATE PEER RESOLUTION [ \"%d\" >= \"%d\" ]", our_port, other_port);
#endif

View File

@ -90,7 +90,7 @@ namespace libtorrent
- (int)c.download_queue().size()
- (int)c.request_queue().size();
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
c.peer_log("*** PIECE_PICKER [ dlq: %d rqq: %d target: %d req: %d engame: %d ]"
, int(c.download_queue().size()), int(c.request_queue().size())
, c.desired_queue_size(), num_requests, c.endgame());
@ -162,7 +162,7 @@ namespace libtorrent
, c.picker_options(), suggested, t.num_peers()
, ses.stats_counters());
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
c.peer_log("*** PIECE_PICKER [ prefer_contiguous: %d picked: %d ]"
, prefer_contiguous_blocks, int(interesting_pieces.size()));
#endif
@ -227,7 +227,7 @@ namespace libtorrent
= std::find_if(dq.begin(), dq.end(), has_block(*i));
if (j != dq.end()) TORRENT_ASSERT(j->timed_out || j->not_wanted);
#endif
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
c.peer_log("*** PIECE_PICKER [ not_picking: %d,%d already in queue ]"
, i->piece_index, i->block_index);
#endif

View File

@ -99,7 +99,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <sys/resource.h>
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/socket_io.hpp"
@ -118,7 +118,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/http_tracker_connection.hpp"
#include "libtorrent/udp_tracker_connection.hpp"
#endif // TORRENT_LOGGING
#endif // TORRENT_DISABLE_LOGGING
#ifdef TORRENT_USE_GCRYPT
@ -361,7 +361,7 @@ namespace aux {
#endif
, m_tracker_manager(m_udp_socket, m_stats_counters, m_host_resolver
, m_ip_filter, m_settings
#if defined TORRENT_LOGGING || TORRENT_USE_ASSERTS
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
, *this
#endif
)
@ -461,7 +461,7 @@ namespace aux {
{
m_alerts.set_alert_mask(pack.get_int(settings_pack::alert_mask));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("start session");
#endif
@ -518,7 +518,7 @@ namespace aux {
// TODO: there's no rule here to make uTP connections not have the global or
// local rate limits apply to it. This used to be the default.
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("config: %s\n"
"version: %s\n"
@ -527,7 +527,7 @@ namespace aux {
, LIBTORRENT_VERSION
, LIBTORRENT_REVISION);
#endif // TORRENT_LOGGING
#endif // TORRENT_DISABLE_LOGGING
#if TORRENT_USE_RLIMIT
// ---- auto-cap max connections ----
@ -535,7 +535,7 @@ namespace aux {
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" max number of open files: %d", rl.rlim_cur);
#endif
// deduct some margin for epoll/kqueue, log files,
@ -547,7 +547,7 @@ namespace aux {
m_settings.get_int(settings_pack::connections_limit)
, int(rl.rlim_cur * 8 / 10)));
// 20% goes towards regular files (see disk_io_thread)
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" max connections: %d", m_settings.get_int(settings_pack::connections_limit));
session_log(" max files: %d", int(rl.rlim_cur * 2 / 10));
#endif
@ -555,7 +555,7 @@ namespace aux {
#endif // TORRENT_USE_RLIMIT
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" generated peer ID: %s", m_peer_id.to_string().c_str());
#endif
@ -564,7 +564,7 @@ namespace aux {
// call update_* after settings set initialized
m_io_service.post(boost::bind(&session_impl::init_settings, this));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" spawning network thread");
#endif
m_thread.reset(new thread(boost::bind(&session_impl::main_thread, this)));
@ -655,7 +655,7 @@ namespace aux {
void session_impl::init()
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" *** session thread init");
#endif
@ -684,7 +684,7 @@ namespace aux {
update_dht_announce_interval();
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" done starting session");
#endif
}
@ -950,7 +950,7 @@ namespace aux {
TORRENT_ASSERT(is_single_thread());
if (m_paused) return;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" *** session paused ***");
#endif
m_paused = true;
@ -982,7 +982,7 @@ namespace aux {
TORRENT_ASSERT(is_single_thread());
if (m_abort) return;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" *** ABORT CALLED ***");
#endif
@ -1038,7 +1038,7 @@ namespace aux {
m_i2p_listen_socket.reset();
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" aborting all torrents (%d)", m_torrents.size());
#endif
// abort all torrents
@ -1049,12 +1049,12 @@ namespace aux {
}
m_torrents.clear();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" aborting all tracker requests");
#endif
m_tracker_manager.abort_all_requests();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" aborting all connections (%d)", m_connections.size());
#endif
// abort all connections
@ -1580,7 +1580,7 @@ namespace aux {
if (m_alerts.should_post<listen_failed_alert>())
m_alerts.emplace_alert<listen_failed_alert>(device, last_op, ec, sock_type);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("failed to open socket: %s: %s"
, device.c_str(), ec.message().c_str());
#endif
@ -1622,7 +1622,7 @@ namespace aux {
while (ec && retries > 0)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("failed to bind to interface [%s] \"%s\": %s"
, device.c_str(), bind_ip.to_string(ec).c_str()
, ec.message().c_str());
@ -1650,7 +1650,7 @@ namespace aux {
// not even that worked, give up
if (m_alerts.should_post<listen_failed_alert>())
m_alerts.emplace_alert<listen_failed_alert>(device, last_op, ec, sock_type);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("cannot bind to interface \"%s\": %s"
, device.c_str(), ec.message().c_str());
#endif
@ -1668,7 +1668,7 @@ namespace aux {
{
if (m_alerts.should_post<listen_failed_alert>())
m_alerts.emplace_alert<listen_failed_alert>(device, last_op, ec, sock_type);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("cannot listen on interface \"%s\": %s"
, device.c_str(), ec.message().c_str());
#endif
@ -1685,7 +1685,7 @@ namespace aux {
{
if (m_alerts.should_post<listen_failed_alert>())
m_alerts.emplace_alert<listen_failed_alert>(device, last_op, ec, sock_type);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("failed to get peer name \"%s\": %s"
, device.c_str(), ec.message().c_str());
#endif
@ -1698,7 +1698,7 @@ namespace aux {
, (flags & open_ssl_socket) ? listen_succeeded_alert::tcp_ssl
: listen_succeeded_alert::tcp);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" listening on: %s external port: %d"
, print_endpoint(tcp::endpoint(bind_ip, port)).c_str(), ret.external_port);
#endif
@ -1707,7 +1707,7 @@ namespace aux {
void session_impl::open_listen_port()
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("open listen port");
#endif
@ -1900,7 +1900,7 @@ retry:
if (m_listen_sockets.empty() && ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("cannot bind TCP listen socket to interface \"%s\": %s"
, print_endpoint(m_listen_interface).c_str(), ec.message().c_str());
#endif
@ -1928,7 +1928,7 @@ retry:
m_ssl_udp_socket.bind(ssl_bind_if, ec);
if (ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("SSL: cannot bind to UDP interface \"%s\": %s"
, print_endpoint(m_listen_interface).c_str(), ec.message().c_str());
#endif
@ -1954,7 +1954,7 @@ retry:
m_udp_socket.bind(udp::endpoint(m_listen_interface.address(), m_listen_interface.port()), ec);
if (ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("cannot bind to UDP interface \"%s\": %s"
, print_endpoint(m_listen_interface).c_str(), ec.message().c_str());
#endif
@ -2101,7 +2101,7 @@ retry:
if (m_alerts.should_post<i2p_alert>())
m_alerts.emplace_alert<i2p_alert>(ec);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("i2p open failed (%d) %s", ec.value(), ec.message().c_str());
#endif
}
@ -2146,7 +2146,7 @@ retry:
if (m_alerts.should_post<listen_failed_alert>())
m_alerts.emplace_alert<listen_failed_alert>("i2p", listen_failed_alert::accept
, e, listen_failed_alert::i2p);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("cannot bind to port %d: %s"
, m_listen_interface.port(), e.message().c_str());
#endif
@ -2169,7 +2169,7 @@ retry:
&& m_alerts.should_post<udp_error_alert>())
m_alerts.emplace_alert<udp_error_alert>(ep, ec);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("UDP socket error: (%d) %s", ec.value(), ec.message().c_str());
#endif
}
@ -2231,7 +2231,7 @@ retry:
if (e)
{
tcp::endpoint ep = listener->local_endpoint(ec);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("error accepting connection on '%s': %s"
, print_endpoint(ep).c_str(), e.message().c_str());
#endif
@ -2346,7 +2346,7 @@ retry:
tcp::endpoint endp = s->remote_endpoint(e);
if (e) return;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" *** peer SSL handshake done [ ip: %s ec: %s socket: %s ]"
, print_endpoint(endp).c_str(), ec.message().c_str(), s->type_name());
#endif
@ -2379,7 +2379,7 @@ retry:
if (m_paused)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" <== INCOMING CONNECTION [ ignored, paused ]");
#endif
return;
@ -2391,7 +2391,7 @@ retry:
if (ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("%s <== INCOMING CONNECTION FAILED, could "
"not retrieve remote endpoint "
, print_endpoint(endp).c_str(), ec.message().c_str());
@ -2399,7 +2399,7 @@ retry:
return;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" <== INCOMING CONNECTION %s type: %s"
, print_endpoint(endp).c_str(), s->type_name());
#endif
@ -2407,7 +2407,7 @@ retry:
if (!m_settings.get_bool(settings_pack::enable_incoming_utp)
&& is_utp(*s))
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" rejected uTP connection");
#endif
if (m_alerts.should_post<peer_blocked_alert>())
@ -2419,7 +2419,7 @@ retry:
if (!m_settings.get_bool(settings_pack::enable_incoming_tcp)
&& s->get<stream_socket>())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" rejected TCP connection");
#endif
if (m_alerts.should_post<peer_blocked_alert>())
@ -2436,7 +2436,7 @@ retry:
tcp::endpoint local = s->local_endpoint(ec);
if (ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" rejected connection: (%d) %s", ec.value()
, ec.message().c_str());
#endif
@ -2447,14 +2447,14 @@ retry:
{
if (ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" rejected connection, not allowed local interface: (%d) %s"
, ec.value(), ec.message().c_str());
#endif
return;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" rejected connection, not allowed local interface: %s"
, local.address().to_string(ec).c_str());
#endif
@ -2478,7 +2478,7 @@ retry:
if (m_stats_counters[counters::non_filter_torrents] == 0
&& (m_ip_filter.access(endp.address()) & ip_filter::blocked))
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("filtered blocked ip");
#endif
if (m_alerts.should_post<peer_blocked_alert>())
@ -2491,7 +2491,7 @@ retry:
// if we don't reject the connection
if (m_torrents.empty())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" There are no torrents, disconnect");
#endif
return;
@ -2527,7 +2527,7 @@ retry:
, error_code(errors::too_many_connections, get_libtorrent_category())
, close_no_reason);
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("number of connections limit exceeded (conns: %d, limit: %d, slack: %d), connection rejected"
, num_connections(), m_settings.get_int(settings_pack::connections_limit)
, m_settings.get_int(settings_pack::connections_slack));
@ -2554,7 +2554,7 @@ retry:
}
if (!has_active_torrent)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" There are no _active_ torrents, disconnect");
#endif
return;
@ -2651,7 +2651,7 @@ retry:
// TORRENT_ASSERT(!i->second->has_peer((peer_connection*)p));
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" CLOSING CONNECTION %s : %s"
, print_endpoint(p->remote()).c_str(), ec.message().c_str());
#endif
@ -2686,7 +2686,7 @@ retry:
int port = m_next_port;
++m_next_port;
if (m_next_port > out_ports.second) m_next_port = out_ports.first;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" *** BINDING OUTGOING CONNECTION [ port: %d ]", port);
#endif
return port;
@ -2833,7 +2833,7 @@ retry:
if (e)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("*** TICK TIMER FAILED %s", e.message().c_str());
#endif
::abort();
@ -3301,7 +3301,7 @@ retry:
TORRENT_ASSERT(m_dht);
m_dht_torrents.push_back(t);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<torrent> tor = t.lock();
if (tor)
session_log("prioritizing DHT announce: \"%s\"", tor->name().c_str());
@ -3330,7 +3330,7 @@ retry:
TORRENT_ASSERT(is_single_thread());
if (e)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("aborting DHT announce timer (%d): %s"
, e.value(), e.message().c_str());
#endif
@ -3339,7 +3339,7 @@ retry:
if (m_abort)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("aborting DHT announce timer: m_abort set");
#endif
return;
@ -3473,7 +3473,7 @@ retry:
{
--hard_limit;
--type_limit;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (!t->allows_peers())
t->log_to_all_peers("AUTO MANAGER STARTING TORRENT");
#endif
@ -3481,7 +3481,7 @@ retry:
}
else
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (t->allows_peers())
t->log_to_all_peers("AUTO MANAGER PAUSING TORRENT");
#endif
@ -4040,7 +4040,7 @@ retry:
stop_loop = m_abort;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" locking mutex");
#endif
@ -4053,7 +4053,7 @@ retry:
}
#endif
*/
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" cleaning up torrents");
#endif
@ -4276,7 +4276,7 @@ retry:
return i->second;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
void session_impl::session_log(char const* fmt, ...) const
{
if (!m_alerts.should_post<log_alert>()) return;
@ -4555,7 +4555,7 @@ retry:
error_code ec;
bdecode_node tmp;
bdecode_node info;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("adding magnet link with resume data");
#endif
if (bdecode(&params.resume_data[0], &params.resume_data[0]
@ -4563,7 +4563,7 @@ retry:
&& tmp.type() == bdecode_node::dict_t
&& (info = tmp.dict_find_dict("info")))
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("found metadata in resume data");
#endif
// verify the info-hash of the metadata stored in the resume file matches
@ -4579,14 +4579,14 @@ retry:
|| !params.url.empty()
|| params.info_hash.is_all_zeros())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("info-hash matched");
#endif
params.ti = boost::make_shared<torrent_info>(resume_ih);
if (params.ti->parse_info_section(info, ec, 0))
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("successfully loaded metadata from resume file");
#endif
// make the info-hash be the one in the resume file
@ -4595,20 +4595,20 @@ retry:
}
else
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("failed to load metadata from resume file: %s"
, ec.message().c_str());
#endif
}
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
else
{
session_log("metadata info-hash failed");
}
#endif
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
else
{
session_log("no metadata found");
@ -4936,7 +4936,7 @@ retry:
// declared in string_util.hpp
parse_comma_separated_string_port(net_interfaces, new_listen_interfaces);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("update listen interfaces: %s", net_interfaces.c_str());
#endif
@ -4964,14 +4964,14 @@ retry:
device_name[0] == '[' ? device_name + 1 : device_name, ec));
if (ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("failed to treat %s as an IP address [ %s ]"
, device_name, ec.message().c_str());
#endif
// it may have been a device name.
std::vector<ip_interface> ifs = enum_net_interfaces(m_io_service, ec);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (ec)
session_log("failed to enumerate interfaces [ %s ]"
, ec.message().c_str());
@ -4985,7 +4985,7 @@ retry:
// connecting to)
if (strcmp(ifs[i].name, device_name) != 0) continue;
m_listen_interface.address(ifs[i].interface_address);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("binding to %s"
, m_listen_interface.address().to_string(ec).c_str());
#endif
@ -4995,7 +4995,7 @@ retry:
if (!found)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("failed to find device %s", device_name);
#endif
// effectively disable whatever socket decides to bind to this
@ -5180,7 +5180,7 @@ retry:
if (t->torrent_file().priv() || (t->torrent_file().is_i2p()
&& !m_settings.get_bool(settings_pack::allow_i2p_mixed))) return;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("added peer from local discovery: %s", print_endpoint(peer).c_str());
#endif
t->add_peer(peer, peer_info::lsd);
@ -5757,7 +5757,7 @@ retry:
m_ssl_udp_socket.set_option(type_of_service(m_settings.get_int(settings_pack::peer_tos)), ec);
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(">>> SET_TOS [ udp_socket tos: %x e: %s ]"
, m_settings.get_int(settings_pack::peer_tos)
, ec.message().c_str());
@ -5967,7 +5967,7 @@ retry:
#ifndef TORRENT_DISABLE_DHT
if (!m_dht)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("not starting DHT announce timer: m_dht == NULL");
#endif
return;
@ -5978,7 +5978,7 @@ retry:
// if we haven't started yet, don't actually trigger this
if (!m_thread)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("not starting DHT announce timer: thread not running yet");
#endif
return;
@ -5986,7 +5986,7 @@ retry:
if (m_abort)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log("not starting DHT announce timer: m_abort set");
#endif
return;
@ -6276,7 +6276,7 @@ retry:
m_lsd = boost::make_shared<lsd>(boost::ref(m_io_service)
, boost::bind(&session_impl::on_lsd_peer, this, _1, _2)
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
, boost::bind(&session_impl::on_lsd_log, this, _1)
#endif
);
@ -6286,7 +6286,7 @@ retry:
m_alerts.emplace_alert<lsd_error_alert>(ec);
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
void session_impl::on_lsd_log(char const* log)
{
if (!m_alerts.should_post<log_alert>()) return;
@ -6456,14 +6456,14 @@ retry:
void session_impl::set_external_address(address const& ip
, int source_type, address const& source)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(": set_external_address(%s, %d, %s)", print_address(ip).c_str()
, source_type, print_address(source).c_str());
#endif
if (!m_external_ip.cast_vote(ip, source_type, source)) return;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
session_log(" external IP updated");
#endif
@ -6734,7 +6734,7 @@ retry:
}
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
tracker_logger::tracker_logger(session_interface& ses): m_ses(ses) {}
void tracker_logger::tracker_warning(tracker_request const& req
, std::string const& str)
@ -6747,7 +6747,7 @@ retry:
, std::list<address> const& ip_list
, struct tracker_response const& resp)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("TRACKER RESPONSE\n"
"interval: %d\n"
"external ip: %s\n"

View File

@ -62,7 +62,7 @@ POSSIBILITY OF SUCH DAMAGE.
//#define TORRENT_LOG_HASH_FAILURES
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/socket_io.hpp"
#endif
@ -139,7 +139,7 @@ namespace
void on_piece_pass(int p)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_torrent.debug_log(" PIECE PASS [ p: %d | block_hash_size: %d ]"
, p, int(m_block_hashes.size()));
#endif
@ -275,7 +275,7 @@ namespace
// this time the digest of the block is different
// from the first time it sent it
// at least one of them must be bad
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
char const* client = "-";
peer_info info;
if (p->connection)
@ -301,7 +301,7 @@ namespace
m_block_hashes.insert(i, std::pair<const piece_block, block_entry>(b, e));
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
char const* client = "-";
peer_info info;
if (p->connection)
@ -350,7 +350,7 @@ namespace
}
if (p == NULL) return;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
char const* client = "-";
peer_info info;
if (p->connection)

View File

@ -97,7 +97,7 @@ POSSIBILITY OF SUCH DAMAGE.
#endif // BOOST_VERSION
#endif // TORRENT_USE_OPENSSL
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/aux_/session_impl.hpp" // for tracker_logger
#endif
@ -719,12 +719,12 @@ namespace libtorrent
// TODO: 2 post alert
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** FAILED SEED MODE, rechecking");
#endif
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** LEAVING SEED MODE (%s)", seed ? "as seed" : "as non-seed");
#endif
m_seed_mode = false;
@ -755,7 +755,7 @@ namespace libtorrent
void torrent::start()
{
TORRENT_ASSERT(is_single_thread());
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("starting torrent");
#endif
std::vector<boost::uint64_t>().swap(m_file_progress);
@ -768,7 +768,7 @@ namespace libtorrent
+ m_resume_data->buf.size(), m_resume_data->node, ec, &pos) != 0)
{
m_resume_data.reset();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("resume data rejected: %s pos: %d", ec.message().c_str(), pos);
#endif
if (m_ses.alerts().should_post<fastresume_rejected_alert>())
@ -1071,7 +1071,7 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
if (!j->error) return;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("disk error: (%d) %s in file: %s", j->error.ec.value(), j->error.ec.message().c_str()
, resolve_filename(j->error.file).c_str());
#endif
@ -1474,7 +1474,7 @@ namespace libtorrent
GENERAL_NAMES* gens = static_cast<GENERAL_NAMES*>(
X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
std::string names;
bool match = false;
#endif
@ -1487,14 +1487,14 @@ namespace libtorrent
const char* torrent_name = reinterpret_cast<const char*>(domain->data);
std::size_t name_length = domain->length;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (i > 1) names += " | n: ";
names.append(torrent_name, name_length);
#endif
if (strncmp(torrent_name, "*", name_length) == 0
|| strncmp(torrent_name, m_torrent_file->name().c_str(), name_length) == 0)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
match = true;
// if we're logging, keep looping over all names,
// for completeness of the log
@ -1519,7 +1519,7 @@ namespace libtorrent
const char* torrent_name = reinterpret_cast<const char*>(common_name->data);
std::size_t name_length = common_name->length;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (!names.empty()) names += " | n: ";
names.append(torrent_name, name_length);
#endif
@ -1527,7 +1527,7 @@ namespace libtorrent
if (strncmp(torrent_name, "*", name_length) == 0
|| strncmp(torrent_name, m_torrent_file->name().c_str(), name_length) == 0)
{
#if !defined TORRENT_LOGGING
#ifdef TORRENT_DISABLE_LOGGING
return true;
#else
match = true;
@ -1535,7 +1535,7 @@ namespace libtorrent
}
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("<== incoming SSL CONNECTION [ n: %s | match: %s ]"
, names.c_str(), match?"yes":"no");
return match;
@ -1709,7 +1709,7 @@ namespace libtorrent
{
TORRENT_ASSERT(is_single_thread());
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("init torrent: %s", torrent_file().name().c_str());
#endif
@ -1770,7 +1770,7 @@ namespace libtorrent
if (ev)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("fastresume data rejected: %s"
, error_code(ev, get_libtorrent_category()).message().c_str());
#endif
@ -1989,7 +1989,7 @@ namespace libtorrent
m_storage.get(), m_resume_data ? &m_resume_data->node : NULL
, links, boost::bind(&torrent::on_resume_data_checked
, shared_from_this(), _1));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("init, async_check_fastresume");
#endif
@ -2305,7 +2305,7 @@ namespace libtorrent
}
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (m_peer_list && m_peer_list->num_peers() > 0)
debug_log("resume added peers (%d)", m_peer_list->num_peers());
#endif
@ -2318,13 +2318,13 @@ namespace libtorrent
, resolve_filename(j->error.file), j->error.operation_str());
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (j->ret != 0)
{
debug_log("fastresume data rejected: ret: %d (%d) %s"
, j->ret, j->error.ec.value(), j->error.ec.message().c_str());
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
else
debug_log("fastresume data accepted");
#endif
@ -2548,7 +2548,7 @@ namespace libtorrent
// resumed quickly, before the outstanding jobs completed
if (m_checking_piece >= m_torrent_file->num_pieces())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("start_checking, checking_piece >= num_pieces. %d >= %d"
, m_checking_piece, m_torrent_file->num_pieces());
#endif
@ -2561,7 +2561,7 @@ namespace libtorrent
if (!need_loaded())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("start_checking, need_loaded() failed");
#endif
return;
@ -2576,7 +2576,7 @@ namespace libtorrent
, shared_from_this(), _1), (void*)1);
if (m_checking_piece >= m_torrent_file->num_pieces()) break;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("start_checking, m_checking_piece: %d", m_checking_piece);
#endif
}
@ -2599,7 +2599,7 @@ namespace libtorrent
{
m_checking_piece = 0;
m_num_checked_pieces = 0;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("on_piece_hashed, disk_check_aborted");
#endif
pause();
@ -2640,7 +2640,7 @@ namespace libtorrent
m_ses.alerts().emplace_alert<file_error_alert>(j->error.ec,
resolve_filename(j->error.file), j->error.operation_str(), get_handle());
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("on_piece_hashed, fatal disk error: (%d) %s", j->error.ec.value(), j->error.ec.message().c_str());
#endif
auto_managed(false);
@ -2659,7 +2659,7 @@ namespace libtorrent
// we're using the piece hashes here, we need the torrent to be loaded
if (!need_loaded())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("on_piece_hashed, need_loaded failed");
#endif
return;
@ -2705,7 +2705,7 @@ namespace libtorrent
// we paused the checking
if (!should_check_files())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("on_piece_hashed, checking paused");
#endif
return;
@ -2713,7 +2713,7 @@ namespace libtorrent
if (!need_loaded())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("on_piece_hashed, need_loaded failed");
#endif
return;
@ -2724,13 +2724,13 @@ namespace libtorrent
, disk_io_job::sequential_access | disk_io_job::volatile_read
, boost::bind(&torrent::on_piece_hashed
, shared_from_this(), _1), (void*)1);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("on_piece_hashed, m_checking_piece: %d", m_checking_piece);
#endif
return;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("on_piece_hashed, completed");
#endif
// we're done checking!
@ -2820,14 +2820,14 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
if (!m_ses.dht())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("DHT: no dht initialized");
#endif
return;
}
if (!should_announce_dht())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (!m_ses.announce_dht())
debug_log("DHT: no listen sockets");
@ -2868,7 +2868,7 @@ namespace libtorrent
int port = m_ses.listen_port();
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("START DHT announce");
m_dht_start_time = clock_type::now();
#endif
@ -2900,7 +2900,7 @@ namespace libtorrent
{
TORRENT_ASSERT(is_single_thread());
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("END DHT announce (%d ms) (%d peers)"
, int(total_milliseconds(clock_type::now() - m_dht_start_time))
, int(peers.size()));
@ -2935,7 +2935,7 @@ namespace libtorrent
if (m_trackers.empty())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** announce: no trackers");
#endif
return;
@ -2947,7 +2947,7 @@ namespace libtorrent
// stopping
if (e != tracker_request::stopped && !m_announce_to_trackers)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** announce: event != stopped && !m_announce_to_trackers");
#endif
return;
@ -2956,7 +2956,7 @@ namespace libtorrent
// if we're not allowing peers, there's no point in announcing
if (e != tracker_request::stopped && !m_allow_peers)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** announce: event != stopped && !m_allow_peers");
#endif
return;
@ -3008,7 +3008,7 @@ namespace libtorrent
for (int i = 0; i < int(m_trackers.size()); ++i)
{
announce_entry& ae = m_trackers[i];
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** tracker: \"%s\" "
"[ tiers: %d trackers: %d"
" i->tier: %d tier: %d"
@ -3091,7 +3091,7 @@ namespace libtorrent
req.auth = tracker_login();
req.key = tracker_key();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("==> TRACKER REQUEST \"%s\" event: %s abort: %d"
, req.url.c_str()
, (req.event==tracker_request::stopped?"stopped"
@ -3269,7 +3269,7 @@ namespace libtorrent
if (resp.complete >= 0 && resp.incomplete >= 0)
m_last_scrape = m_ses.session_time();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("TRACKER RESPONSE\n"
"interval: %d\n"
"external ip: %s\n"
@ -3409,7 +3409,7 @@ namespace libtorrent
?m_ses.get_ipv6_interface().address()
:m_ses.get_ipv4_interface().address();
announce_with_tracker(r.event, bind_interface);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("announce again using %s as the bind interface"
, print_address(bind_interface).c_str());
#endif
@ -3475,7 +3475,7 @@ namespace libtorrent
continue;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
external_ip const& external = m_ses.external_address();
debug_log(" *** FOUND CONNECTION CANDIDATE ["
" ip: %s rank: %u external: %s t: %d ]"
@ -3543,7 +3543,7 @@ namespace libtorrent
INVARIANT_CHECK;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (ec)
debug_log("i2p_resolve error: %s", ec.message().c_str());
#endif
@ -3568,7 +3568,7 @@ namespace libtorrent
complete_async("torrent::on_peer_name_lookup");
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (e)
debug_log("peer name lookup error: %s", e.message().c_str());
#endif
@ -3581,7 +3581,7 @@ namespace libtorrent
if (m_apply_ip_filter
&& m_ses.get_ip_filter().access(host.address()) & ip_filter::blocked)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
error_code ec;
debug_log("blocked ip from tracker: %s", host.address().to_string(ec).c_str());
#endif
@ -3945,7 +3945,7 @@ namespace libtorrent
// -1: disk failure
// -2: piece failed check
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** PIECE_FINISHED [ p: %d | chk: %s | size: %d ]"
, j->piece, ((ret == 0)
?"passed":ret == -1
@ -4185,7 +4185,7 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
TORRENT_ASSERT(!m_picker->has_piece_passed(index));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("PIECE_PASSED (%d)", num_passed());
#endif
@ -4260,7 +4260,7 @@ namespace libtorrent
for (peer_iterator p = m_connections.begin()
, end(m_connections.end()); p != end; ++p)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
(*p)->peer_log(">>> PREDICTIVE_HAVE [ piece: %d expected in %d ms]"
, index, milliseconds);
#endif
@ -4402,11 +4402,11 @@ namespace libtorrent
if (p->connection)
{
peer_connection* peer = static_cast<peer_connection*>(p->connection);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** BANNING PEER: \"%s\" Too many corrupt pieces"
, print_endpoint(p->ip()).c_str());
#endif
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer->peer_log("*** BANNING PEER: Too many corrupt pieces");
#endif
peer->disconnect(errors::too_many_corrupt_pieces, op_bittorrent);
@ -4764,7 +4764,7 @@ namespace libtorrent
error_code ec;
m_inactivity_timer.cancel(ec);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_to_all_peers("ABORTING TORRENT");
#endif
@ -5513,7 +5513,7 @@ namespace libtorrent
p->update_interest();
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** UPDATE_PEER_INTEREST [ finished: %d was_finished %d ]"
, is_finished(), was_finished);
#endif
@ -5997,7 +5997,7 @@ namespace libtorrent
if (ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("failed to parse web seed url: %s", ec.message().c_str());
#endif
if (m_ses.alerts().should_post<url_seed_alert>())
@ -6012,7 +6012,7 @@ namespace libtorrent
if (web->peer_info.banned)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("banned web seed: %s", web->url.c_str());
#endif
if (m_ses.alerts().should_post<url_seed_alert>())
@ -6082,7 +6082,7 @@ namespace libtorrent
return;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("resolving web seed: %s", web->url.c_str());
#endif
@ -6090,7 +6090,7 @@ namespace libtorrent
if (ps.type == settings_pack::http
|| ps.type == settings_pack::http_pw)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("resolving proxy for web seed: %s", web->url.c_str());
#endif
@ -6108,7 +6108,7 @@ namespace libtorrent
}
else
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("resolving web seed: %s", web->url.c_str());
#endif
@ -6128,7 +6128,7 @@ namespace libtorrent
INVARIANT_CHECK;
TORRENT_ASSERT(web->resolving == true);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("completed resolve proxy hostname for: %s", web->url.c_str());
if (e)
debug_log("proxy name lookup error: %s", e.message().c_str());
@ -6137,7 +6137,7 @@ namespace libtorrent
if (web->removed)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("removed web seed");
#endif
remove_web_seed(web);
@ -6213,13 +6213,13 @@ namespace libtorrent
INVARIANT_CHECK;
TORRENT_ASSERT(web->resolving == true);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("completed resolve: %s", web->url.c_str());
#endif
web->resolving = false;
if (web->removed)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("removed web seed");
#endif
remove_web_seed(web);
@ -6232,7 +6232,7 @@ namespace libtorrent
{
if (m_ses.alerts().should_post<url_seed_alert>())
m_ses.alerts().emplace_alert<url_seed_alert>(get_handle(), web->url, e);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** HOSTNAME LOOKUP FAILED: %s: (%d) %s"
, web->url.c_str(), e.value(), e.message().c_str());
#endif
@ -6248,7 +6248,7 @@ namespace libtorrent
// fill in the peer struct's address field
web->endpoints.push_back(tcp::endpoint(*i, port));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log(" -> %s", print_endpoint(tcp::endpoint(*i, port)).c_str());
#endif
}
@ -6414,7 +6414,7 @@ namespace libtorrent
, boost::int64_t(web->peer_info.prev_amount_upload) << 10);
web->peer_info.prev_amount_download = 0;
web->peer_info.prev_amount_upload = 0;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("web seed connection started: [%s] %s"
, print_endpoint(a).c_str(), web->url.c_str());
#endif
@ -6423,7 +6423,7 @@ namespace libtorrent
if (c->is_disconnecting()) return;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("START queue peer [%p] (%d)", c.get(), num_peers());
#endif
}
@ -6431,7 +6431,7 @@ namespace libtorrent
{
TORRENT_DECLARE_DUMMY(std::exception, e);
(void)e;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** PEER_ERROR: %s", e.what());
#endif
c->disconnect(errors::no_error, op_bittorrent, 1);
@ -6584,7 +6584,7 @@ namespace libtorrent
{
// unknown country!
p->set_country("!!");
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("IP \"%s\" was mapped to unknown country: %d"
, print_address(p->remote().address()).c_str(), country);
#endif
@ -7730,7 +7730,7 @@ namespace libtorrent
if (!m_peer_list->new_connection(*p, m_ses.session_time(), &st))
{
peers_erased(st.erased);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("CLOSING CONNECTION \"%s\" peer list full"
, print_endpoint(p->remote()).c_str());
#endif
@ -7744,7 +7744,7 @@ namespace libtorrent
{
TORRENT_DECLARE_DUMMY(std::exception, e);
(void)e;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("CLOSING CONNECTION \"%s\" caught exception: %s"
, print_endpoint(p->remote()).c_str(), e.what());
#endif
@ -7762,7 +7762,7 @@ namespace libtorrent
++m_num_seeds;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("incoming peer (%d)", int(m_connections.size()));
#endif
@ -8038,7 +8038,7 @@ namespace libtorrent
TORRENT_ASSERT(p->associated_torrent().lock().get() == this);
if (p->upload_only())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
p->peer_log("*** SEED, CLOSING CONNECTION");
#endif
seeds.push_back(p);
@ -8079,7 +8079,7 @@ namespace libtorrent
|| m_state == torrent_status::checking_files
|| m_state == torrent_status::allocating)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** RESUME_DOWNLOAD [ skipping, state: %d ]"
, int(m_state));
#endif
@ -8092,7 +8092,7 @@ namespace libtorrent
m_completed_time = 0;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** RESUME_DOWNLOAD");
#endif
send_upload_only();
@ -8188,7 +8188,7 @@ namespace libtorrent
if (m_abort)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("files_checked(), paused");
#endif
return;
@ -8279,7 +8279,7 @@ namespace libtorrent
pc->init();
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
pc->peer_log("*** ON_FILES_CHECKED");
#endif
if (pc->is_interesting() && !pc->has_peer_choked())
@ -8765,7 +8765,7 @@ namespace libtorrent
{
TORRENT_ASSERT(is_single_thread());
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_to_all_peers("DELETING FILES IN TORRENT");
#endif
@ -8838,7 +8838,7 @@ namespace libtorrent
alerts().emplace_alert<torrent_error_alert>(get_handle(), ec
, resolve_filename(error_file));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (ec)
{
char buf[1024];
@ -9179,7 +9179,7 @@ namespace libtorrent
update_want_peers();
update_want_scrape();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
log_to_all_peers("PAUSING TORRENT");
#endif
@ -9236,7 +9236,7 @@ namespace libtorrent
if (p->outstanding_bytes() > 0)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
p->peer_log("*** CHOKING PEER: torrent graceful paused");
#endif
// remove any un-sent requests from the queue
@ -9246,7 +9246,7 @@ namespace libtorrent
continue;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
p->peer_log("*** CLOSING CONNECTION: torrent_paused");
#endif
p->disconnect(errors::torrent_paused, op_bittorrent);
@ -9268,11 +9268,11 @@ namespace libtorrent
}
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
void torrent::log_to_all_peers(char const* message)
{
TORRENT_ASSERT(is_single_thread());
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
for (peer_iterator i = m_connections.begin();
i != m_connections.end(); ++i)
{
@ -9397,7 +9397,7 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
if (!m_announcing)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** update tracker timer: not announcing");
#endif
return;
@ -9411,7 +9411,7 @@ namespace libtorrent
for (std::vector<announce_entry>::iterator i = m_trackers.begin()
, end(m_trackers.end()); i != end; ++i)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
char msg[1000];
snprintf(msg, sizeof(msg), "*** tracker: \"%s\" "
"[ tiers: %d trackers: %d"
@ -9449,7 +9449,7 @@ namespace libtorrent
&& !settings().get_bool(settings_pack::announce_to_all_tiers)) break;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
char msg[200];
snprintf(msg, sizeof(msg), "*** update tracker timer: next_announce < now %d"
" m_waiting_tracker: %d next_announce_in: %d"
@ -9479,7 +9479,7 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
if (is_paused())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("start_announcing(), paused");
#endif
return;
@ -9489,14 +9489,14 @@ namespace libtorrent
// request the metadata from
if (!m_files_checked && valid_metadata())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("start_announcing(), files not checked (with valid metadata)");
#endif
return;
}
if (!m_torrent_file->is_valid() && !m_url.empty())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("start_announcing(), downloading URL");
#endif
return;
@ -9728,7 +9728,7 @@ namespace libtorrent
{
TORRENT_DECLARE_DUMMY(std::exception, e);
(void)e;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
p->peer_log("*** ERROR %s", e.what());
#endif
p->disconnect(errors::no_error, op_bittorrent, 1);
@ -10663,7 +10663,7 @@ namespace libtorrent
TORRENT_ASSERT(i->resolving == false);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("disconnect web seed: \"%s\"", i->url.c_str());
#endif
TORRENT_ASSERT(i->peer_info.connection);
@ -11237,7 +11237,7 @@ namespace libtorrent
m_state = s;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("set_state() %d", m_state);
#endif
@ -11576,7 +11576,7 @@ namespace libtorrent
INVARIANT_CHECK;
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** tracker error: (%d) %s %s", ec.value()
, ec.message().c_str(), msg.c_str());
#endif
@ -11589,7 +11589,7 @@ namespace libtorrent
ae->last_error = ec;
ae->message = msg;
int tracker_index = ae - &m_trackers[0];
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** increment tracker fail count [%d]", ae->fails);
#endif
// never talk to this tracker again
@ -11623,7 +11623,7 @@ namespace libtorrent
update_tracker_timer(aux::time_now());
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
void torrent::debug_log(char const* fmt, ...) const
{
if (!alerts().should_post<torrent_log_alert>()) return;

View File

@ -200,7 +200,7 @@ namespace libtorrent
, resolver_interface& resolver
, struct ip_filter& ipf
, aux::session_settings const& sett
#if defined TORRENT_LOGGING || TORRENT_USE_ASSERTS
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
, aux::session_logger& ses
#endif
)
@ -209,7 +209,7 @@ namespace libtorrent
, m_host_resolver(resolver)
, m_settings(sett)
, m_stats_counters(stats_counters)
#if defined TORRENT_LOGGING || TORRENT_USE_ASSERTS
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
, m_ses(ses)
#endif
, m_abort(false)
@ -319,7 +319,7 @@ namespace libtorrent
// ignore packets smaller than 8 bytes
if (size < 8)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_ses.session_log("incoming packet from %s, not a UDP tracker message "
"(%d Bytes)", print_endpoint(ep).c_str(), size);
#endif
@ -332,7 +332,7 @@ namespace libtorrent
if (i == m_udp_conns.end())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_ses.session_log("incoming UDP tracker packet from %s has invalid "
"transaction ID (%" PRIu32 ")", print_endpoint(ep).c_str()
, transaction);
@ -362,7 +362,7 @@ namespace libtorrent
if (i == m_udp_conns.end())
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
// now, this may not have been meant to be a tracker response,
// but chances are pretty good, so it's probably worth logging
m_ses.session_log("incoming UDP tracker packet from %s has invalid "
@ -395,7 +395,7 @@ namespace libtorrent
close_http_connections.push_back(*i);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> rc = c->requester();
if (rc) rc->debug_log("aborting: %s", req.url.c_str());
#endif
@ -410,7 +410,7 @@ namespace libtorrent
close_udp_connections.push_back(c);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> rc = c->requester();
if (rc) rc->debug_log("aborting: %s", req.url.c_str());
#endif

View File

@ -56,7 +56,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/ip_filter.hpp"
#include "libtorrent/aux_/time.hpp"
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/socket_io.hpp"
#endif
@ -126,7 +126,7 @@ namespace libtorrent
, boost::bind(&udp_tracker_connection::name_lookup
, shared_from_this(), _1, _2, port));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> cb = requester();
if (cb) cb->debug_log("*** UDP_TRACKER [ initiating name lookup: \"%s\" ]"
, hostname.c_str());
@ -155,7 +155,7 @@ namespace libtorrent
return;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> cb = requester();
if (cb) cb->debug_log("*** UDP_TRACKER [ host: \"%s\" ip: \"%s\" | error: \"%s\" ]"
, m_hostname.c_str(), print_endpoint(m_target).c_str(), ec.message().c_str());
@ -164,7 +164,7 @@ namespace libtorrent
// pick another target endpoint and try again
m_target = pick_target_endpoint();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("*** UDP_TRACKER trying next IP [ host: \"%s\" ip: \"%s\" ]"
, m_hostname.c_str(), print_endpoint(m_target).c_str());
#endif
@ -193,7 +193,7 @@ namespace libtorrent
}
boost::shared_ptr<request_callback> cb = requester();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("*** UDP_TRACKER [ name lookup successful ]");
#endif
if (cancelled())
@ -220,7 +220,7 @@ namespace libtorrent
{
if (m_man.ip_filter().access(k->address()) == ip_filter::blocked)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("*** UDP_TRACKER [ IP blocked by filter: %s ]"
, print_address(k->address()).c_str());
#endif
@ -314,7 +314,7 @@ namespace libtorrent
return;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> cb = requester();
if (cb) cb->debug_log("*** UDP_TRACKER [ timed out url: %s ]", tracker_req().url.c_str());
#endif
@ -340,14 +340,14 @@ namespace libtorrent
bool udp_tracker_connection::on_receive(error_code const& e
, udp::endpoint const& ep, char const* buf, int size)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> cb = requester();
#endif
// ignore resposes before we've sent any requests
if (m_state == action_error)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("<== UDP_TRACKER [ m_action == error ]");
#endif
return false;
@ -355,7 +355,7 @@ namespace libtorrent
if (m_abort)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("<== UDP_TRACKER [ aborted]");
#endif
return false;
@ -367,7 +367,7 @@ namespace libtorrent
// the hostname, in which case this packet might be for us
if (!is_any(m_target.address()) && m_target != ep)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("<== UDP_TRACKER [ unexpected source IP: %s "
"expected: %s ]"
, print_endpoint(ep).c_str()
@ -378,7 +378,7 @@ namespace libtorrent
if (e) fail(e);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("<== UDP_TRACKER_PACKET [ size: %d ]", size);
#endif
@ -389,14 +389,14 @@ namespace libtorrent
int action = detail::read_int32(ptr);
boost::uint32_t transaction = detail::read_uint32(ptr);
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("*** UDP_TRACKER_PACKET [ action: %d ]", action);
#endif
// ignore packets with incorrect transaction id
if (m_transaction_id != transaction)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("*** UDP_TRACKER_PACKET [ tid: %x ]"
, int(transaction));
#endif
@ -412,7 +412,7 @@ namespace libtorrent
// ignore packets that's not a response to our message
if (action != m_state)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("*** UDP_TRACKER_PACKET [ unexpected action: %d "
" expected: %d ]", action, m_state);
#endif
@ -421,7 +421,7 @@ namespace libtorrent
restart_read_timeout();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb)
cb->debug_log("*** UDP_TRACKER_RESPONSE [ tid: %x ]"
, int(transaction));
@ -480,13 +480,13 @@ namespace libtorrent
void udp_tracker_connection::send_udp_connect()
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> cb = requester();
#endif
if (m_abort)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("==> UDP_TRACKER_CONNECT [ skipped, m_abort ]");
#endif
return;
@ -518,7 +518,7 @@ namespace libtorrent
++m_attempts;
if (ec)
{
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb) cb->debug_log("==> UDP_TRACKER_CONNECT [ failed: %s ]"
, ec.message().c_str());
#endif
@ -526,7 +526,7 @@ namespace libtorrent
return;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb)
{
char hex_ih[41];
@ -606,7 +606,7 @@ namespace libtorrent
}
boost::shared_ptr<request_callback> cb = requester();
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (cb)
{
boost::shared_ptr<request_callback> cb = requester();
@ -755,7 +755,7 @@ namespace libtorrent
TORRENT_ASSERT(out - buf <= int(sizeof(buf)));
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
boost::shared_ptr<request_callback> cb = requester();
if (cb)
{

View File

@ -264,7 +264,7 @@ namespace libtorrent { namespace
TORRENT_ASSERT(type >= 0 && type <= 2);
TORRENT_ASSERT(!m_pc.associated_torrent().expired());
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
char const* names[] = {"request", "data", "dont-have"};
char const* n = "";
if (type >= 0 && type < 3) n = names[type];
@ -330,7 +330,7 @@ namespace libtorrent { namespace
if (length > 17 * 1024)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("<== UT_METADATA [ packet too big %d ]", length);
#endif
m_pc.disconnect(errors::invalid_metadata_message, op_bittorrent, 2);
@ -343,7 +343,7 @@ namespace libtorrent { namespace
entry msg = bdecode(body.begin, body.end, len);
if (msg.type() != entry::dictionary_t)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("<== UT_METADATA [ not a dictionary ]");
#endif
m_pc.disconnect(errors::invalid_metadata_message, op_bittorrent, 2);
@ -355,7 +355,7 @@ namespace libtorrent { namespace
if (type_ent == 0 || type_ent->type() != entry::int_t
|| piece_ent == 0 || piece_ent->type() != entry::int_t)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("<== UT_METADATA [ missing or invalid keys ]");
#endif
m_pc.disconnect(errors::invalid_metadata_message, op_bittorrent, 2);
@ -364,7 +364,7 @@ namespace libtorrent { namespace
int type = type_ent->integer();
int piece = piece_ent->integer();
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("<== UT_METADATA [ type: %d | piece: %d ]", type, piece);
#endif
@ -375,7 +375,7 @@ namespace libtorrent { namespace
if (!m_torrent.valid_metadata()
|| piece < 0 || piece >= int(m_tp.get_metadata_size() + 16 * 1024 - 1)/(16*1024))
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("*** UT_METADATA [ have: %d invalid piece %d metadata size: %d ]"
, int(m_torrent.valid_metadata()), piece
, int(m_tp.get_metadata_size()));
@ -399,7 +399,7 @@ namespace libtorrent { namespace
// unwanted piece?
if (i == m_sent_requests.end())
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("*** UT_METADATA [ UNWANTED / TIMED OUT ]");
#endif
return true;
@ -547,7 +547,7 @@ namespace libtorrent { namespace
{
if (m_torrent.valid_metadata())
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
source.m_pc.peer_log("*** UT_METADATA [ ALREADY HAVE METADATA ]");
#endif
m_torrent.add_redundant_bytes(size, torrent::piece_unknown);
@ -559,7 +559,7 @@ namespace libtorrent { namespace
// verify the total_size
if (total_size <= 0 || total_size > m_torrent.session().settings().get_int(settings_pack::max_metadata_size))
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
source.m_pc.peer_log("*** UT_METADATA [ metadata size too big: %d ]", total_size);
#endif
// #error post alert
@ -573,7 +573,7 @@ namespace libtorrent { namespace
if (piece < 0 || piece >= int(m_requested_metadata.size()))
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
source.m_pc.peer_log("*** UT_METADATA [ piece: %d INVALID ]", piece);
#endif
return false;
@ -581,7 +581,7 @@ namespace libtorrent { namespace
if (total_size != m_metadata_size)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
source.m_pc.peer_log("*** UT_METADATA [ total_size: %d INCONSISTENT WITH: %d ]"
, total_size, m_metadata_size);
#endif

View File

@ -56,7 +56,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/extensions/ut_pex.hpp"
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/lazy_entry.hpp"
#endif
@ -311,7 +311,7 @@ namespace libtorrent { namespace
bdecode_node p = pex_msg.dict_find_string("dropped");
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
int num_dropped = 0;
int num_added = 0;
if (p) num_dropped += p.string_length()/6;
@ -333,7 +333,7 @@ namespace libtorrent { namespace
p = pex_msg.dict_find_string("added");
bdecode_node pf = pex_msg.dict_find_string("added.f");
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (p) num_added += p.string_length() / 6;
#endif
if (p && pf && pf.string_length() == p.string_length() / 6)
@ -365,7 +365,7 @@ namespace libtorrent { namespace
#if TORRENT_USE_IPV6
bdecode_node p6 = pex_msg.dict_find("dropped6");
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (p6) num_dropped += p6.string_length() / 18;
#endif
if (p6 != 0 && p6.type() == bdecode_node::string_t)
@ -383,7 +383,7 @@ namespace libtorrent { namespace
}
p6 = pex_msg.dict_find("added6");
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
if (p6) num_added += p6.string_length() / 18;
#endif
bdecode_node p6f = pex_msg.dict_find("added6.f");
@ -415,7 +415,7 @@ namespace libtorrent { namespace
}
}
#endif
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("<== PEX [ dropped: %d added: %d ]"
, num_dropped, num_added);
#endif
@ -434,7 +434,7 @@ namespace libtorrent { namespace
time_point now = aux::time_now();
if (now - seconds(60) < m_last_msg)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("*** PEX [ waiting: %d seconds to next msg ]"
, total_seconds(seconds(60) - (now - m_last_msg)));
#endif
@ -452,7 +452,7 @@ namespace libtorrent { namespace
if (now - milliseconds(delay) < global_last)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("*** PEX [ global-wait: %d ]", total_seconds(milliseconds(delay) - (now - global_last)));
#endif
return;
@ -497,7 +497,7 @@ namespace libtorrent { namespace
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_extended);
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_pex);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
bdecode_node m;
error_code ec;
int ret = bdecode(&pex_msg[0], &pex_msg[0] + pex_msg.size(), m, ec);
@ -605,7 +605,7 @@ namespace libtorrent { namespace
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_extended);
m_pc.stats_counters().inc_stats_counter(counters::num_outgoing_pex);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log("==> PEX_FULL [ added: %d msg_size: %d ]", num_added, int(pex_msg.size()));
#endif
}

View File

@ -676,10 +676,6 @@ public:
bool m_stalled:1;
};
#if defined TORRENT_LOGGING
int socket_impl_size() { return sizeof(utp_socket_impl); }
#endif
utp_socket_impl* construct_utp_impl(boost::uint16_t recv_id
, boost::uint16_t send_id, void* userdata
, utp_socket_manager* sm)

View File

@ -98,7 +98,7 @@ web_peer_connection::web_peer_connection(peer_connection_args const& pack
// into single larger ones
request_large_blocks(true);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** web_peer_connection %s", m_url.c_str());
#endif
}
@ -122,7 +122,7 @@ void web_peer_connection::disconnect(error_code const& ec
if (op == op_sock_write && ec == boost::system::errc::broken_pipe)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
// a write operation failed with broken-pipe. This typically happens
// with HTTP 1.0 servers that close their incoming channel of the TCP
// stream whenever they're done reading one full request. Instead of
@ -156,7 +156,7 @@ void web_peer_connection::disconnect(error_code const& ec
if (!m_requests.empty() && !m_file_requests.empty()
&& !m_piece.empty() && m_web)
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** SAVE-RESTART-DATA: [ data: %d req: %d off: %d ]"
, int(m_piece.size()), int(m_requests.front().piece)
, int(m_requests.front().start));
@ -276,7 +276,7 @@ void web_peer_connection::write_request(peer_request const& r)
pr.piece = r.piece + request_offset / piece_size;
m_requests.push_back(pr);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> REQUESTING [ piece: %d start: %d len: %d ]"
, pr.piece, pr.start, pr.length);
#endif
@ -288,7 +288,7 @@ void web_peer_connection::write_request(peer_request const& r)
peer_request& front = m_requests.front();
TORRENT_ASSERT(front.length > int(m_piece.size()));
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** RESTART-DATA: [ data: %d req: (%d, %d) ]"
, int(m_piece.size()), int(front.piece), int(front.start)
, int (front.start + front.length - 1));
@ -395,7 +395,7 @@ void web_peer_connection::write_request(peer_request const& r)
}
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("==> %s", request.c_str());
#endif
@ -441,7 +441,7 @@ bool web_peer_connection::maybe_harvest_block()
buffer::const_interval recv_buffer = m_recv_buffer.get();
incoming_piece(front_request, &m_piece[0]);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== POP REQUEST [ piece: %d start: %d len: %d ]"
, front_request.piece, front_request.start, front_request.length);
#endif
@ -518,7 +518,7 @@ void web_peer_connection::on_receive(error_code const& error
if (error)
{
received_bytes(0, bytes_transferred);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** web_peer_connection error: %s", error.message().c_str());
#endif
#ifdef TORRENT_DEBUG
@ -556,7 +556,7 @@ void web_peer_connection::on_receive(error_code const& error
if (failed)
{
received_bytes(0, bytes_transferred);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** %s", std::string(recv_buffer.begin, recv_buffer.end).c_str());
#endif
disconnect(errors::http_parse_error, op_bittorrent, 2);
@ -613,7 +613,7 @@ void web_peer_connection::on_receive(error_code const& error
m_web->supports_keepalive = false;
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** STATUS: %d %s", m_parser.status_code(), m_parser.message().c_str());
std::multimap<std::string, std::string> const& headers = m_parser.headers();
for (std::multimap<std::string, std::string>::const_iterator i = headers.begin()
@ -711,7 +711,7 @@ void web_peer_connection::on_receive(error_code const& error
location = resolve_redirect_location(m_url, location);
}
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** LOCATION: %s", location.c_str());
#endif
t->add_web_seed(location, web_seed_entry::url_seed, m_external_auth, m_extra_headers);
@ -820,7 +820,7 @@ void web_peer_connection::on_receive(error_code const& error
}
else
{
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** parsed chunk: %d header_size: %d", chunk_size, header_size);
#endif
TORRENT_ASSERT(int(bytes_transferred) >= header_size - m_partial_chunk_header);
@ -870,7 +870,7 @@ void web_peer_connection::on_receive(error_code const& error
TORRENT_ASSERT(m_block_pos >= 0);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("*** payload_transferred: %d [ %d:%d = %d ]"
, payload_transferred, front_request.piece
, front_request.start, front_request.length);
@ -915,7 +915,7 @@ void web_peer_connection::on_receive(error_code const& error
, front_request.length - m_block_pos));
received_bytes(0, bytes_transferred);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
std::vector<file_slice> sl = info.orig_files().map_block(
front_request.piece, front_request.start, front_request.start
+ front_request.length);
@ -980,7 +980,7 @@ void web_peer_connection::on_receive(error_code const& error
incoming_piece_fragment(r.length);
incoming_piece(r, recv_buffer.begin);
#ifdef TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
peer_log("<== POP REQUEST [ piece: %d start: %d len: %d ]"
, r.piece, r.start, r.length);
#endif

View File

@ -71,7 +71,7 @@ struct mock_peer_connection : peer_connection_interface
virtual ~mock_peer_connection() {}
#if defined TORRENT_LOGGING
#if !defined TORRENT_DISABLE_LOGGING
virtual void peer_log(char const* fmt, ...) const
{
va_list v;
@ -130,7 +130,7 @@ struct mock_torrent
return true;
}
#if defined TORRENT_LOGGING
#ifndef TORRENT_DISABLE_LOGGING
void debug_log(const char* fmt, ...) const
{
va_list v;