forked from premiere/premiere-libtorrent
const correctness
This commit is contained in:
parent
8a984effa7
commit
1f13343a70
|
@ -313,7 +313,7 @@ namespace libtorrent
|
||||||
void dht_get_mutable_item(boost::array<char, 32> key
|
void dht_get_mutable_item(boost::array<char, 32> key
|
||||||
, std::string salt = std::string());
|
, 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
|
void dht_put_mutable_item(boost::array<char, 32> key
|
||||||
, boost::function<void(entry&, boost::array<char,64>&
|
, boost::function<void(entry&, boost::array<char,64>&
|
||||||
|
|
|
@ -104,14 +104,14 @@ namespace libtorrent { namespace dht
|
||||||
// for immutable_item.
|
// for immutable_item.
|
||||||
// the callback function will be called when put operation is done.
|
// the callback function will be called when put operation is done.
|
||||||
// the int parameter indicates the success numbers of put operation.
|
// 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);
|
, boost::function<void(int)> cb);
|
||||||
|
|
||||||
// for mutable_item.
|
// for mutable_item.
|
||||||
// the data_cb will be called when we get authoritative mutable_item,
|
// the data_cb will be called when we get authoritative mutable_item,
|
||||||
// the cb is same as put immutable_item.
|
// the cb is same as put immutable_item.
|
||||||
void put_item(char const* key
|
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());
|
, boost::function<void(item&)> data_cb, std::string salt = std::string());
|
||||||
|
|
||||||
// send an arbitrary DHT request directly to a node
|
// send an arbitrary DHT request directly to a node
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace libtorrent { namespace dht
|
||||||
class get_item : public find_data
|
class get_item : public find_data
|
||||||
{
|
{
|
||||||
public:
|
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,
|
void got_data(bdecode_node const& v,
|
||||||
char const* pk,
|
char const* pk,
|
||||||
|
|
|
@ -177,12 +177,12 @@ public:
|
||||||
void direct_request(udp::endpoint ep, entry& e
|
void direct_request(udp::endpoint ep, entry& e
|
||||||
, boost::function<void(msg const&)> f);
|
, boost::function<void(msg const&)> f);
|
||||||
|
|
||||||
void get_item(sha1_hash const& target, boost::function<void(item&)> 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&, bool)> 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
|
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);
|
, boost::function<void(item&)> data_cb);
|
||||||
|
|
||||||
bool verify_token(std::string const& token, char const* info_hash
|
bool verify_token(std::string const& token, char const* info_hash
|
||||||
|
|
|
@ -53,7 +53,7 @@ class node;
|
||||||
|
|
||||||
struct put_data: traversal_algorithm
|
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);
|
put_data(node& node, put_callback const& callback);
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,7 @@ namespace libtorrent { namespace dht
|
||||||
m_dht.get_item(key, salt, cb);
|
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)
|
, boost::function<void(int)> cb)
|
||||||
{
|
{
|
||||||
std::string flat_data;
|
std::string flat_data;
|
||||||
|
@ -266,7 +266,7 @@ namespace libtorrent { namespace dht
|
||||||
}
|
}
|
||||||
|
|
||||||
void dht_tracker::put_item(char const* key
|
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)
|
, boost::function<void(item&)> data_cb, std::string salt)
|
||||||
{
|
{
|
||||||
m_dht.put_item(key, salt, cb, data_cb);
|
m_dht.put_item(key, salt, cb, data_cb);
|
||||||
|
|
|
@ -423,7 +423,7 @@ void node::direct_request(udp::endpoint ep, entry& e
|
||||||
}
|
}
|
||||||
|
|
||||||
void node::get_item(sha1_hash const& target
|
void node::get_item(sha1_hash const& target
|
||||||
, boost::function<void(item&)> f)
|
, boost::function<void(item const&)> f)
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
if (m_observer)
|
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
|
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
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
if (m_observer)
|
if (m_observer)
|
||||||
|
@ -466,7 +466,7 @@ void put(std::vector<std::pair<node_entry, std::string> > const& nodes
|
||||||
ta->start();
|
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::intrusive_ptr<put_data> ta
|
||||||
, boost::function<void(item&)> f)
|
, boost::function<void(item&)> f)
|
||||||
{
|
{
|
||||||
|
@ -480,7 +480,7 @@ void put_data_cb(item& i, bool auth
|
||||||
|
|
||||||
} // namespace
|
} // 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
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
if (m_observer)
|
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
|
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)
|
, boost::function<void(item&)> data_cb)
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
|
|
|
@ -5654,7 +5654,7 @@ retry:
|
||||||
alerts.emplace_alert<dht_put_alert>(target, num);
|
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, 64> sig = i.sig();
|
||||||
boost::array<char, 32> pk = i.pk();
|
boost::array<char, 32> pk = i.pk();
|
||||||
|
@ -5694,7 +5694,7 @@ retry:
|
||||||
|
|
||||||
} // anonymous namespace
|
} // 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;
|
if (!m_dht) return;
|
||||||
m_dht->put_item(data, boost::bind(&on_dht_put_immutable_item, boost::ref(m_alerts)
|
m_dht->put_item(data, boost::bind(&on_dht_put_immutable_item, boost::ref(m_alerts)
|
||||||
|
|
|
@ -481,7 +481,7 @@ std::vector<dht::item> g_got_items;
|
||||||
dht::item g_put_item;
|
dht::item g_put_item;
|
||||||
int g_put_count;
|
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 (!a) return;
|
||||||
if (!i.empty())
|
if (!i.empty())
|
||||||
|
@ -498,12 +498,12 @@ void put_mutable_item_data_cb(dht::item& i)
|
||||||
g_put_count++;
|
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);
|
TEST_EQUAL(num, expect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_immutable_item_cb(dht::item& i)
|
void get_immutable_item_cb(dht::item const& i)
|
||||||
{
|
{
|
||||||
if (!i.empty())
|
if (!i.empty())
|
||||||
g_got_items.push_back(i);
|
g_got_items.push_back(i);
|
||||||
|
|
Loading…
Reference in New Issue