mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 20:44:56 +00:00
remove deprecated putData function from libtorrent
This commit is contained in:
parent
5af649a58a
commit
0bd6bc4807
@ -307,10 +307,6 @@ namespace libtorrent
|
|||||||
// the DHT, to get the initial peers quickly
|
// the DHT, to get the initial peers quickly
|
||||||
void prioritize_dht(boost::weak_ptr<torrent> t);
|
void prioritize_dht(boost::weak_ptr<torrent> t);
|
||||||
|
|
||||||
void dht_putData(std::string const &username, std::string const &resource, bool multi,
|
|
||||||
entry const &value, std::string const &sig_user,
|
|
||||||
boost::int64_t timeutc, int seq);
|
|
||||||
|
|
||||||
void dht_putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void dht_putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
||||||
|
|
||||||
|
@ -96,10 +96,6 @@ namespace libtorrent { namespace dht
|
|||||||
, address addr, int listen_port, bool seed, bool myself, int list_peers
|
, address addr, int listen_port, bool seed, bool myself, int list_peers
|
||||||
, boost::function<void(std::vector<tcp::endpoint> const&)> f);
|
, boost::function<void(std::vector<tcp::endpoint> const&)> f);
|
||||||
|
|
||||||
void putData(std::string const &username, std::string const &resource, bool multi,
|
|
||||||
entry const &value, std::string const &sig_user,
|
|
||||||
boost::int64_t timeutc, int seq);
|
|
||||||
|
|
||||||
void putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
||||||
|
|
||||||
|
@ -223,10 +223,6 @@ public:
|
|||||||
, address addr, int listen_port, bool seed, bool myself, int list_peers
|
, address addr, int listen_port, bool seed, bool myself, int list_peers
|
||||||
, boost::function<void(std::vector<tcp::endpoint> const&)> f);
|
, boost::function<void(std::vector<tcp::endpoint> const&)> f);
|
||||||
|
|
||||||
void putData(std::string const &username, std::string const &resource, bool multi,
|
|
||||||
entry const &value, std::string const &sig_user,
|
|
||||||
boost::int64_t timeutc, int seq);
|
|
||||||
|
|
||||||
void putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
||||||
|
|
||||||
|
@ -438,10 +438,6 @@ namespace libtorrent
|
|||||||
void add_dht_router(std::pair<std::string, int> const& node);
|
void add_dht_router(std::pair<std::string, int> const& node);
|
||||||
|
|
||||||
// [MF] twister
|
// [MF] twister
|
||||||
void dht_putData(std::string const &username, std::string const &resource, bool multi,
|
|
||||||
entry const &value, std::string const &sig_user,
|
|
||||||
boost::int64_t timeutc, int seq);
|
|
||||||
|
|
||||||
void dht_putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void dht_putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local);
|
||||||
|
|
||||||
|
@ -433,13 +433,6 @@ namespace libtorrent { namespace dht
|
|||||||
m_dht.announce(trackerName, ih, addr, listen_port, seed, myself, list_peers, f);
|
m_dht.announce(trackerName, ih, addr, listen_port, seed, myself, list_peers, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dht_tracker::putData(std::string const &username, std::string const &resource, bool multi,
|
|
||||||
entry const &value, std::string const &sig_user,
|
|
||||||
boost::int64_t timeutc, int seq)
|
|
||||||
{
|
|
||||||
m_dht.putData(username,resource, multi, value, sig_user, timeutc, seq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dht_tracker::putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void dht_tracker::putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local)
|
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local)
|
||||||
{
|
{
|
||||||
|
@ -425,55 +425,6 @@ void node_impl::announce(std::string const& trackerName, sha1_hash const& info_h
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void node_impl::putData(std::string const &username, std::string const &resource, bool multi,
|
|
||||||
entry const &value, std::string const &sig_user,
|
|
||||||
boost::int64_t timeutc, int seq)
|
|
||||||
{
|
|
||||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
|
||||||
TORRENT_LOG(node) << "putData [ username: " << info_hash << " res: " << resource << " ]" ;
|
|
||||||
#endif
|
|
||||||
printf("putData: username=%s,res=%s,multi=%d sig_user=%s\n",
|
|
||||||
username.c_str(), resource.c_str(), multi, sig_user.c_str());
|
|
||||||
|
|
||||||
// construct p dictionary and sign it
|
|
||||||
entry p;
|
|
||||||
entry& target = p["target"];
|
|
||||||
target["n"] = username;
|
|
||||||
target["r"] = resource;
|
|
||||||
target["t"] = (multi) ? "m" : "s";
|
|
||||||
if (seq >= 0 && !multi) p["seq"] = seq;
|
|
||||||
p["v"] = value;
|
|
||||||
p["time"] = timeutc;
|
|
||||||
int height = getBestHeight()-1; // be conservative
|
|
||||||
p["height"] = height;
|
|
||||||
|
|
||||||
std::vector<char> pbuf;
|
|
||||||
bencode(std::back_inserter(pbuf), p);
|
|
||||||
std::string str_p = std::string(pbuf.data(),pbuf.size());
|
|
||||||
std::string sig_p = createSignature(str_p, sig_user);
|
|
||||||
if( !sig_p.size() ) {
|
|
||||||
printf("putData: createSignature error (this should have been caught earlier)\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// search for nodes with ids close to id or with peers
|
|
||||||
// for info-hash id. then send putData to them.
|
|
||||||
boost::intrusive_ptr<dht_get> ta(new dht_get(*this, username, resource, multi,
|
|
||||||
boost::bind(&nop),
|
|
||||||
boost::bind(&putData_fun, _1, boost::ref(*this), p, sig_p, sig_user), true));
|
|
||||||
|
|
||||||
// store it locally so it will be automatically refreshed with the rest
|
|
||||||
dht_storage_item item(str_p, sig_p, sig_user);
|
|
||||||
item.local_add_time = time(NULL);
|
|
||||||
std::vector<char> vbuf;
|
|
||||||
bencode(std::back_inserter(vbuf), value);
|
|
||||||
std::pair<char const*, int> bufv = std::make_pair(vbuf.data(), vbuf.size());
|
|
||||||
store_dht_item(item, ta->target(), multi, seq, height, bufv);
|
|
||||||
|
|
||||||
// now send it to the network (start transversal algorithm)
|
|
||||||
ta->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void node_impl::putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void node_impl::putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local)
|
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local)
|
||||||
{
|
{
|
||||||
|
@ -854,15 +854,6 @@ namespace libtorrent
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void session::dht_putData(std::string const &username, std::string const &resource, bool multi,
|
|
||||||
entry const &value, std::string const &sig_user,
|
|
||||||
boost::int64_t timeutc, int seq)
|
|
||||||
{
|
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
|
||||||
TORRENT_ASYNC_CALL7(dht_putData, username, resource, multi, value, sig_user, timeutc, seq);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void session::dht_putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void session::dht_putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local)
|
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local)
|
||||||
{
|
{
|
||||||
|
@ -5780,14 +5780,6 @@ retry:
|
|||||||
boost::bind(&session_impl::on_dht_router_name_lookup, this, _1, _2));
|
boost::bind(&session_impl::on_dht_router_name_lookup, this, _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void session_impl::dht_putData(std::string const &username, std::string const &resource, bool multi,
|
|
||||||
entry const &value, std::string const &sig_user,
|
|
||||||
boost::int64_t timeutc, int seq)
|
|
||||||
{
|
|
||||||
if (m_dht) m_dht->putData(username, resource, multi, value, sig_user, timeutc, seq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void session_impl::dht_putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
void session_impl::dht_putDataSigned(std::string const &username, std::string const &resource, bool multi,
|
||||||
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local)
|
entry const &p, std::string const &sig_p, std::string const &sig_user, bool local)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user