fix warnings and a peer logging bug

This commit is contained in:
Arvid Norberg 2015-05-10 18:38:10 +00:00
parent 0029ac62a8
commit 494b425ea1
9 changed files with 43 additions and 19 deletions

View File

@ -575,7 +575,8 @@ namespace libtorrent
virtual void announce(sha1_hash const& ih, address const& addr, int port) TORRENT_OVERRIDE; virtual void announce(sha1_hash const& ih, address const& addr, int port) TORRENT_OVERRIDE;
virtual void outgoing_get_peers(sha1_hash const& target virtual void outgoing_get_peers(sha1_hash const& target
, sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE; , sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE;
virtual void log(libtorrent::dht::dht_logger::dht_module_t m, char const* fmt, ...) TORRENT_OVERRIDE; virtual void log(libtorrent::dht::dht_logger::dht_module_t m, char const* fmt, ...)
TORRENT_OVERRIDE TORRENT_FORMAT(3,4);
void set_external_address(address const& ip void set_external_address(address const& ip
, int source_type, address const& source); , int source_type, address const& source);

View File

@ -309,12 +309,14 @@ namespace libtorrent
socket_recv_size20, socket_recv_size20,
num_stats_counters, num_stats_counters,
};
// == ALL FOLLOWING ARE GAUGES == // == ALL FOLLOWING ARE GAUGES ==
// it is important that all gauges have a higher index than counters. // it is important that all gauges have a higher index than counters.
// This assumption is relied upon in other parts of the code // This assumption is relied upon in other parts of the code
enum stats_gauge_t
{
num_checking_torrents = num_stats_counters, num_checking_torrents = num_stats_counters,
num_stopped_torrents, num_stopped_torrents,
// upload_only means finished // upload_only means finished
@ -429,7 +431,7 @@ namespace libtorrent
num_utp_deleted, num_utp_deleted,
num_counters, num_counters,
num_gauge_counters = num_counters - num_stats_counters num_gauges_counters = num_counters - num_stats_counters
}; };
counters(); counters();

View File

@ -1724,7 +1724,7 @@ namespace libtorrent {
std::string dht_log_alert::message() const std::string dht_log_alert::message() const
{ {
const static char const* dht_modules[] = static char const* const dht_modules[] =
{ {
"tracker", "tracker",
"node", "node",

View File

@ -32,9 +32,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <set> #include <set>
#include <numeric> #include <numeric>
#include <boost/bind.hpp>
#include <boost/function/function0.hpp> #include "libtorrent/config.hpp"
#include <boost/ref.hpp>
#include "libtorrent/kademlia/node.hpp" #include "libtorrent/kademlia/node.hpp"
#include "libtorrent/kademlia/node_id.hpp" #include "libtorrent/kademlia/node_id.hpp"
@ -51,6 +50,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/time.hpp" #include "libtorrent/time.hpp"
#include "libtorrent/performance_counters.hpp" // for counters #include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp>
#include <boost/function/function0.hpp>
#include <boost/ref.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
using boost::ref; using boost::ref;
using libtorrent::dht::node; using libtorrent::dht::node;
using libtorrent::dht::node_id; using libtorrent::dht::node_id;

View File

@ -30,12 +30,18 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libtorrent/config.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp" #include "libtorrent/aux_/disable_warnings_push.hpp"
#include <utility> #include <utility>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/function/function1.hpp> #include <boost/function/function1.hpp>
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/io.hpp" #include "libtorrent/io.hpp"
@ -45,6 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/random.hpp" #include "libtorrent/random.hpp"
#include "libtorrent/aux_/session_impl.hpp" #include "libtorrent/aux_/session_impl.hpp"
#include "libtorrent/alert_types.hpp" // for dht_lookup #include "libtorrent/alert_types.hpp" // for dht_lookup
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/kademlia/node_id.hpp" #include "libtorrent/kademlia/node_id.hpp"
#include "libtorrent/kademlia/rpc_manager.hpp" #include "libtorrent/kademlia/rpc_manager.hpp"
@ -55,11 +62,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/kademlia/refresh.hpp" #include "libtorrent/kademlia/refresh.hpp"
#include "libtorrent/kademlia/get_peers.hpp" #include "libtorrent/kademlia/get_peers.hpp"
#include "libtorrent/kademlia/get_item.hpp" #include "libtorrent/kademlia/get_item.hpp"
#include "libtorrent/performance_counters.hpp" // for counters
#ifdef TORRENT_USE_VALGRIND
#include <valgrind/memcheck.h>
#endif
namespace libtorrent { namespace dht namespace libtorrent { namespace dht
{ {

View File

@ -35,8 +35,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <algorithm> // std::copy, std::remove_copy_if #include <algorithm> // std::copy, std::remove_copy_if
#include <functional> #include <functional>
#include <numeric> #include <numeric>
#include <boost/cstdint.hpp>
#include <boost/bind.hpp> #include "libtorrent/config.hpp"
#include "libtorrent/kademlia/routing_table.hpp" #include "libtorrent/kademlia/routing_table.hpp"
#include "libtorrent/broadcast_socket.hpp" // for cidr_distance #include "libtorrent/broadcast_socket.hpp" // for cidr_distance
@ -46,9 +46,15 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/time.hpp" #include "libtorrent/time.hpp"
#include "libtorrent/alert_types.hpp" // for dht_routing_bucket #include "libtorrent/alert_types.hpp" // for dht_routing_bucket
#include "libtorrent/socket_io.hpp" // for print_endpoint #include "libtorrent/socket_io.hpp" // for print_endpoint
#include "libtorrent/invariant_check.hpp" #include "libtorrent/invariant_check.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/cstdint.hpp>
#include <boost/bind.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
using boost::uint8_t; using boost::uint8_t;
#if BOOST_VERSION <= 104700 #if BOOST_VERSION <= 104700

View File

@ -30,10 +30,15 @@ POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libtorrent/config.hpp"
#include "libtorrent/socket.hpp" #include "libtorrent/socket.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <libtorrent/io.hpp> #include <libtorrent/io.hpp>
#include <libtorrent/random.hpp> #include <libtorrent/random.hpp>
#include <libtorrent/invariant_check.hpp> #include <libtorrent/invariant_check.hpp>

View File

@ -617,7 +617,7 @@ namespace libtorrent
TORRENT_ASSERT(i->address() == c.remote().address()); TORRENT_ASSERT(i->address() == c.remote().address());
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
c.peer_log(peer_log_alert::info, "DUPLICATE PEER [ this: \"%s\" that: \"%s\" ]" c.peer_log(peer_log_alert::info, "DUPLICATE PEER", "this: \"%s\" that: \"%s\""
, print_address(c.remote().address()).c_str() , print_address(c.remote().address()).c_str()
, print_address(i->address()).c_str()); , print_address(i->address()).c_str());
#endif #endif

View File

@ -6464,6 +6464,7 @@ retry:
m_alerts.emplace_alert<dht_outgoing_get_peers_alert>(target, sent_target, ep); m_alerts.emplace_alert<dht_outgoing_get_peers_alert>(target, sent_target, ep);
} }
TORRENT_FORMAT(3,4)
void session_impl::log(libtorrent::dht::dht_logger::dht_module_t m, char const* fmt, ...) void session_impl::log(libtorrent::dht::dht_logger::dht_module_t m, char const* fmt, ...)
{ {
if (!m_alerts.should_post<dht_log_alert>()) return; if (!m_alerts.should_post<dht_log_alert>()) return;