add back version in DHT packets

This commit is contained in:
Arvid Norberg 2011-01-23 02:02:04 +00:00
parent ec6ef250bf
commit de28a57954
6 changed files with 13 additions and 9 deletions

View File

@ -75,7 +75,7 @@ namespace libtorrent { namespace dht
{
friend void intrusive_ptr_add_ref(dht_tracker const*);
friend void intrusive_ptr_release(dht_tracker const*);
friend bool send_callback(void* userdata, entry const& e, udp::endpoint const& addr, int flags);
friend bool send_callback(void* userdata, entry& e, udp::endpoint const& addr, int flags);
dht_tracker(libtorrent::aux::session_impl& ses, rate_limited_udp_socket& sock
, dht_settings const& settings, entry const* state = 0);
@ -113,7 +113,7 @@ namespace libtorrent { namespace dht
void tick(error_code const& e);
void on_bootstrap(std::vector<std::pair<node_entry, std::string> > const&);
bool send_packet(libtorrent::entry const& e, udp::endpoint const& addr, int send_flags);
bool send_packet(libtorrent::entry& e, udp::endpoint const& addr, int send_flags);
node_impl m_dht;
libtorrent::aux::session_impl& m_ses;

View File

@ -213,7 +213,7 @@ public:
typedef boost::function3<void, address, int, address> external_ip_fun;
node_impl(libtorrent::alert_manager& alerts
, bool (*f)(void*, entry const&, udp::endpoint const&, int)
, bool (*f)(void*, entry&, udp::endpoint const&, int)
, dht_settings const& settings, node_id nid, address const& external_address
, external_ip_fun ext_ip, void* userdata);
@ -334,7 +334,7 @@ private:
int m_secret[2];
libtorrent::alert_manager& m_alerts;
bool (*m_send)(void*, entry const&, udp::endpoint const&, int);
bool (*m_send)(void*, entry&, udp::endpoint const&, int);
void* m_userdata;
};

View File

@ -68,7 +68,7 @@ class routing_table;
class rpc_manager
{
public:
typedef bool (*send_fun)(void* userdata, entry const&, udp::endpoint const&, int);
typedef bool (*send_fun)(void* userdata, entry&, udp::endpoint const&, int);
typedef boost::function3<void, address, int, address> external_ip_fun;
rpc_manager(node_id const& our_id

View File

@ -198,7 +198,7 @@ namespace libtorrent { namespace dht
return node_id(node_id(nid->string().c_str()));
}
bool send_callback(void* userdata, entry const& e, udp::endpoint const& addr, int flags)
bool send_callback(void* userdata, entry& e, udp::endpoint const& addr, int flags)
{
dht_tracker* self = (dht_tracker*)userdata;
return self->send_packet(e, addr, flags);
@ -615,12 +615,16 @@ namespace libtorrent { namespace dht
// #error post an alert
}
bool dht_tracker::send_packet(libtorrent::entry const& e, udp::endpoint const& addr, int send_flags)
bool dht_tracker::send_packet(libtorrent::entry& e, udp::endpoint const& addr, int send_flags)
{
TORRENT_ASSERT(m_ses.is_network_thread());
using libtorrent::bencode;
using libtorrent::entry;
static char const version_str[] = {'L', 'T'
, LIBTORRENT_VERSION_MAJOR, LIBTORRENT_VERSION_MINOR};
e["v"] = std::string(version_str, version_str + 4);
m_send_buf.clear();
bencode(std::back_inserter(m_send_buf), e);
error_code ec;

View File

@ -176,7 +176,7 @@ void purge_peers(std::set<peer_entry>& peers)
void nop() {}
node_impl::node_impl(libtorrent::alert_manager& alerts
, bool (*f)(void*, entry const&, udp::endpoint const&, int)
, bool (*f)(void*, entry&, udp::endpoint const&, int)
, dht_settings const& settings, node_id nid, address const& external_address
, external_ip_fun ext_ip, void* userdata)
: m_settings(settings)

View File

@ -44,7 +44,7 @@ using namespace libtorrent::dht;
std::list<std::pair<udp::endpoint, entry> > g_responses;
bool our_send(void* user, entry const& msg, udp::endpoint const& ep, int flags)
bool our_send(void* user, entry& msg, udp::endpoint const& ep, int flags)
{
g_responses.push_back(std::make_pair(ep, msg));
return true;