fix build with verbose logging

This commit is contained in:
Arvid Norberg 2014-10-04 19:54:12 +00:00
parent 520aead4da
commit d296960efa
6 changed files with 23 additions and 14 deletions

View File

@ -724,7 +724,6 @@ void bind_session()
.def("set_max_uploads", allow_threads(&lt::session::set_max_uploads))
.def("set_max_connections", allow_threads(&lt::session::set_max_connections))
.def("max_connections", allow_threads(&lt::session::max_connections))
.def("set_max_half_open_connections", allow_threads(&lt::session::set_max_half_open_connections))
.def("num_connections", allow_threads(&lt::session::num_connections))
.def("set_settings", &lt::session::set_settings)
.def("settings", &lt::session::settings)
@ -745,6 +744,7 @@ void bind_session()
.def("load_state", &load_state)
.def("save_state", &save_state, (arg("entry"), arg("flags") = 0xffffffff))
#ifndef TORRENT_NO_DEPRECATE
.def("set_max_half_open_connections", allow_threads(&lt::session::set_max_half_open_connections))
.def("set_severity_level", allow_threads(&lt::session::set_severity_level))
.def("set_alert_queue_size_limit", allow_threads(&lt::session::set_alert_queue_size_limit))
.def("set_alert_mask", allow_threads(&lt::session::set_alert_mask))

View File

@ -7,6 +7,7 @@
#include <libtorrent/torrent_info.hpp>
#include "libtorrent/session_settings.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/socket_io.hpp"
#include "bytes.hpp"
using namespace boost::python;
@ -59,8 +60,11 @@ namespace
d["retry"] = total_seconds(i->retry - min_time());
d["resolving"] = i->resolving;
d["removed"] = i->removed;
d["endpoint"] = make_tuple(
boost::lexical_cast<std::string>(i->endpoint.address()), i->endpoint.port());
list endpoints;
for (std::vector<tcp::endpoint>::const_iterator k = i->endpoints.begin()
, end(i->endpoints.end()); k != end; ++k)
endpoints.append(make_tuple(print_address(k->address()), k->port()));
d["endpoints"] = endpoints;
ret.append(d);
}

View File

@ -432,10 +432,7 @@ namespace libtorrent
// file_storage, otherwise returns the original file_storage object.
file_storage const& files() const { return m_mapped_files?*m_mapped_files:m_files; }
// we need access to these for logging purposes
#if !defined TORRENT_VERBOSE_LOGGING && !defined TORRENT_LOGGING && !defined TORRENT_ERROR_LOGGING
private:
#endif
// this identifies a read or write operation
// so that default_storage::readwritev() knows what to

View File

@ -1065,6 +1065,9 @@ namespace libtorrent
#endif
#ifndef TORRENT_NO_DEPRECATE
void session::set_max_half_open_connections(int limit) {}
int session::max_half_open_connections() const { return 8; }
int session::max_uploads() const
{
return TORRENT_SYNC_CALL_RET(int, max_uploads);

View File

@ -94,6 +94,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/session_settings.hpp"
#include "libtorrent/torrent_peer.hpp"
#if defined TORRENT_VERBOSE_LOGGING
#include "libtorrent/socket_io.hpp"
#endif
#if defined TORRENT_STATS && defined __MACH__
#include <mach/task.h>
#endif
@ -7664,9 +7668,9 @@ retry:
"external ip: %s\n"
"we connected to: %s\n"
"peers:"
, interval
, resp.interval
, print_address(resp.external_ip).c_str()
, print_address(resp.tracker_ip).c_str());
, print_address(tracker_ip).c_str());
for (std::vector<peer_entry>::const_iterator i = resp.peers.begin();
i != resp.peers.end(); ++i)
@ -7678,13 +7682,13 @@ retry:
for (std::vector<ipv4_peer_entry>::const_iterator i = resp.peers4.begin();
i != resp.peers4.end(); ++i)
{
debug_log(" %16s %5d", print_address(i->ip).c_str(), i->port);
debug_log(" %s:%d", print_address(address_v4(i->ip)).c_str(), i->port);
}
#if TORRENT_USE_IPV6
for (std::vector<ipv6_peer_entry>::const_iterator i = resp.peers6.begin();
i != resp.peers6.end(); ++i)
{
debug_log(" %16s %5d", print_address(i->ip).c_str(), i->port);
debug_log(" [%s]:%d", print_address(address_v6(i->ip)).c_str(), i->port);
}
#endif
#endif

View File

@ -3180,7 +3180,7 @@ namespace libtorrent
"peers:"
, interval
, print_address(resp.external_ip).c_str()
, print_address(resp.tracker_ip).c_str());
, print_address(tracker_ip).c_str());
for (std::vector<peer_entry>::const_iterator i = resp.peers.begin();
i != resp.peers.end(); ++i)
@ -3192,13 +3192,13 @@ namespace libtorrent
for (std::vector<ipv4_peer_entry>::const_iterator i = resp.peers4.begin();
i != resp.peers4.end(); ++i)
{
debug_log(" %16s %5d", print_address(i->ip).c_str(), i->port);
debug_log(" %s:%d", print_address(address_v4(i->ip)).c_str(), i->port);
}
#if TORRENT_USE_IPV6
for (std::vector<ipv6_peer_entry>::const_iterator i = resp.peers6.begin();
i != resp.peers6.end(); ++i)
{
debug_log(" %16s %5d", print_address(i->ip).c_str(), i->port);
debug_log(" [%s]:%d", print_address(address_v6(i->ip)).c_str(), i->port);
}
#endif
#endif
@ -9319,7 +9319,8 @@ namespace libtorrent
char msg[200];
snprintf(msg, sizeof(msg), "*** update tracker timer: next_announce < now %d"
" m_waiting_tracker: %d next_announce_in: %d"
, next_announce <= now, m_waiting_tracker, total_seconds(now - next_announce));
, next_announce <= now, m_waiting_tracker
, int(total_seconds(now - next_announce)));
debug_log(msg);
#endif
if (next_announce <= now) next_announce = now;