Merge pull request #287 from ssiloti/master

Small fixes
This commit is contained in:
Arvid Norberg 2015-11-22 13:58:10 -05:00
commit adb70a8dc3
11 changed files with 25 additions and 26 deletions

View File

@ -313,7 +313,7 @@ namespace libtorrent
void dht_get_mutable_item(boost::array<char, 32> key
, std::string salt = std::string());
void dht_put_immutable_item(entry data, sha1_hash target);
void dht_put_immutable_item(entry const& data, sha1_hash target);
void dht_put_mutable_item(boost::array<char, 32> key
, boost::function<void(entry&, boost::array<char,64>&

View File

@ -104,14 +104,14 @@ namespace libtorrent { namespace dht
// for immutable_item.
// the callback function will be called when put operation is done.
// the int parameter indicates the success numbers of put operation.
void put_item(entry data
void put_item(entry const& data
, boost::function<void(int)> cb);
// for mutable_item.
// the data_cb will be called when we get authoritative mutable_item,
// the cb is same as put immutable_item.
void put_item(char const* key
, boost::function<void(item&, int)> cb
, boost::function<void(item const&, int)> cb
, boost::function<void(item&)> data_cb, std::string salt = std::string());
// send an arbitrary DHT request directly to a node

View File

@ -43,7 +43,7 @@ namespace libtorrent { namespace dht
class get_item : public find_data
{
public:
typedef boost::function<void(item&, bool)> data_callback;
typedef boost::function<void(item const&, bool)> data_callback;
void got_data(bdecode_node const& v,
char const* pk,

View File

@ -177,12 +177,12 @@ public:
void direct_request(udp::endpoint ep, entry& e
, boost::function<void(msg const&)> f);
void get_item(sha1_hash const& target, boost::function<void(item&)> f);
void get_item(char const* pk, std::string const& salt, boost::function<void(item&, bool)> f);
void get_item(sha1_hash const& target, boost::function<void(item const&)> f);
void get_item(char const* pk, std::string const& salt, boost::function<void(item const&, bool)> f);
void put_item(sha1_hash const& target, entry& data, boost::function<void(int)> f);
void put_item(sha1_hash const& target, entry const& data, boost::function<void(int)> f);
void put_item(char const* pk, std::string const& salt
, boost::function<void(item&, int)> f
, boost::function<void(item const&, int)> f
, boost::function<void(item&)> data_cb);
bool verify_token(std::string const& token, char const* info_hash

View File

@ -53,7 +53,7 @@ class node;
struct put_data: traversal_algorithm
{
typedef boost::function<void(item&, int)> put_callback;
typedef boost::function<void(item const&, int)> put_callback;
put_data(node& node, put_callback const& callback);

View File

@ -254,7 +254,7 @@ namespace libtorrent { namespace dht
m_dht.get_item(key, salt, cb);
}
void dht_tracker::put_item(entry data
void dht_tracker::put_item(entry const& data
, boost::function<void(int)> cb)
{
std::string flat_data;
@ -266,7 +266,7 @@ namespace libtorrent { namespace dht
}
void dht_tracker::put_item(char const* key
, boost::function<void(item&, int)> cb
, boost::function<void(item const&, int)> cb
, boost::function<void(item&)> data_cb, std::string salt)
{
m_dht.put_item(key, salt, cb, data_cb);

View File

@ -423,7 +423,7 @@ void node::direct_request(udp::endpoint ep, entry& e
}
void node::get_item(sha1_hash const& target
, boost::function<void(item&)> f)
, boost::function<void(item const&)> f)
{
#ifndef TORRENT_DISABLE_LOGGING
if (m_observer)
@ -441,7 +441,7 @@ void node::get_item(sha1_hash const& target
}
void node::get_item(char const* pk, std::string const& salt
, boost::function<void(item&, bool)> f)
, boost::function<void(item const&, bool)> f)
{
#ifndef TORRENT_DISABLE_LOGGING
if (m_observer)
@ -466,7 +466,7 @@ void put(std::vector<std::pair<node_entry, std::string> > const& nodes
ta->start();
}
void put_data_cb(item& i, bool auth
void put_data_cb(item i, bool auth
, boost::intrusive_ptr<put_data> ta
, boost::function<void(item&)> f)
{
@ -480,7 +480,7 @@ void put_data_cb(item& i, bool auth
} // namespace
void node::put_item(sha1_hash const& target, entry& data, boost::function<void(int)> f)
void node::put_item(sha1_hash const& target, entry const& data, boost::function<void(int)> f)
{
#ifndef TORRENT_DISABLE_LOGGING
if (m_observer)
@ -505,7 +505,7 @@ void node::put_item(sha1_hash const& target, entry& data, boost::function<void(i
}
void node::put_item(char const* pk, std::string const& salt
, boost::function<void(item&, int)> f
, boost::function<void(item const&, int)> f
, boost::function<void(item&)> data_cb)
{
#ifndef TORRENT_DISABLE_LOGGING

View File

@ -67,7 +67,6 @@ void put_data::set_targets(std::vector<std::pair<node_entry, std::string> > cons
void put_data::done()
{
if (m_invoke_count != 0) return;
m_done = true;
#ifndef TORRENT_DISABLE_LOGGING

View File

@ -5654,7 +5654,7 @@ retry:
alerts.emplace_alert<dht_put_alert>(target, num);
}
void on_dht_put_mutable_item(alert_manager& alerts, dht::item& i, int num)
void on_dht_put_mutable_item(alert_manager& alerts, dht::item const& i, int num)
{
boost::array<char, 64> sig = i.sig();
boost::array<char, 32> pk = i.pk();
@ -5694,7 +5694,7 @@ retry:
} // anonymous namespace
void session_impl::dht_put_immutable_item(entry data, sha1_hash target)
void session_impl::dht_put_immutable_item(entry const& data, sha1_hash target)
{
if (!m_dht) return;
m_dht->put_item(data, boost::bind(&on_dht_put_immutable_item, boost::ref(m_alerts)

View File

@ -481,7 +481,7 @@ std::vector<dht::item> g_got_items;
dht::item g_put_item;
int g_put_count;
void get_mutable_item_cb(dht::item& i, bool a)
void get_mutable_item_cb(dht::item const& i, bool a)
{
if (!a) return;
if (!i.empty())
@ -498,12 +498,12 @@ void put_mutable_item_data_cb(dht::item& i)
g_put_count++;
}
void put_mutable_item_cb(dht::item&, int num, int expect)
void put_mutable_item_cb(dht::item const&, int num, int expect)
{
TEST_EQUAL(num, expect);
}
void get_immutable_item_cb(dht::item& i)
void get_immutable_item_cb(dht::item const& i)
{
if (!i.empty())
g_got_items.push_back(i);