From 0bd6bc480702860726fb951b9061cd99ec76e481 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Wed, 25 Jun 2014 18:42:33 -0300 Subject: [PATCH] remove deprecated putData function from libtorrent --- .../include/libtorrent/aux_/session_impl.hpp | 4 -- .../libtorrent/kademlia/dht_tracker.hpp | 4 -- .../include/libtorrent/kademlia/node.hpp | 4 -- libtorrent/include/libtorrent/session.hpp | 4 -- libtorrent/src/kademlia/dht_tracker.cpp | 7 --- libtorrent/src/kademlia/node.cpp | 49 ------------------- libtorrent/src/session.cpp | 9 ---- libtorrent/src/session_impl.cpp | 8 --- 8 files changed, 89 deletions(-) diff --git a/libtorrent/include/libtorrent/aux_/session_impl.hpp b/libtorrent/include/libtorrent/aux_/session_impl.hpp index 6ae37e5e..0d269a41 100644 --- a/libtorrent/include/libtorrent/aux_/session_impl.hpp +++ b/libtorrent/include/libtorrent/aux_/session_impl.hpp @@ -307,10 +307,6 @@ namespace libtorrent // the DHT, to get the initial peers quickly void prioritize_dht(boost::weak_ptr 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, entry const &p, std::string const &sig_p, std::string const &sig_user, bool local); diff --git a/libtorrent/include/libtorrent/kademlia/dht_tracker.hpp b/libtorrent/include/libtorrent/kademlia/dht_tracker.hpp index bbf5a433..a60b8741 100644 --- a/libtorrent/include/libtorrent/kademlia/dht_tracker.hpp +++ b/libtorrent/include/libtorrent/kademlia/dht_tracker.hpp @@ -96,10 +96,6 @@ namespace libtorrent { namespace dht , address addr, int listen_port, bool seed, bool myself, int list_peers , boost::function 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, entry const &p, std::string const &sig_p, std::string const &sig_user, bool local); diff --git a/libtorrent/include/libtorrent/kademlia/node.hpp b/libtorrent/include/libtorrent/kademlia/node.hpp index 939447d5..d8de0180 100644 --- a/libtorrent/include/libtorrent/kademlia/node.hpp +++ b/libtorrent/include/libtorrent/kademlia/node.hpp @@ -223,10 +223,6 @@ public: , address addr, int listen_port, bool seed, bool myself, int list_peers , boost::function 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, entry const &p, std::string const &sig_p, std::string const &sig_user, bool local); diff --git a/libtorrent/include/libtorrent/session.hpp b/libtorrent/include/libtorrent/session.hpp index be0c75a4..5186bbc2 100644 --- a/libtorrent/include/libtorrent/session.hpp +++ b/libtorrent/include/libtorrent/session.hpp @@ -438,10 +438,6 @@ namespace libtorrent void add_dht_router(std::pair const& node); // [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, entry const &p, std::string const &sig_p, std::string const &sig_user, bool local); diff --git a/libtorrent/src/kademlia/dht_tracker.cpp b/libtorrent/src/kademlia/dht_tracker.cpp index 5e0c109d..1469513f 100644 --- a/libtorrent/src/kademlia/dht_tracker.cpp +++ b/libtorrent/src/kademlia/dht_tracker.cpp @@ -433,13 +433,6 @@ namespace libtorrent { namespace dht 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, entry const &p, std::string const &sig_p, std::string const &sig_user, bool local) { diff --git a/libtorrent/src/kademlia/node.cpp b/libtorrent/src/kademlia/node.cpp index 61c866d6..9342d05f 100644 --- a/libtorrent/src/kademlia/node.cpp +++ b/libtorrent/src/kademlia/node.cpp @@ -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 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 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 vbuf; - bencode(std::back_inserter(vbuf), value); - std::pair 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, entry const &p, std::string const &sig_p, std::string const &sig_user, bool local) { diff --git a/libtorrent/src/session.cpp b/libtorrent/src/session.cpp index a696097c..145019aa 100644 --- a/libtorrent/src/session.cpp +++ b/libtorrent/src/session.cpp @@ -854,15 +854,6 @@ namespace libtorrent #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, entry const &p, std::string const &sig_p, std::string const &sig_user, bool local) { diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index f6d4b3f9..9ca2cfd7 100644 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -5780,14 +5780,6 @@ retry: 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, entry const &p, std::string const &sig_p, std::string const &sig_user, bool local) {