forked from premiere/premiere-libtorrent
minor cleanup and fix no-deprecated build
This commit is contained in:
parent
db4a9962e9
commit
4b585dcc0e
|
@ -63,8 +63,6 @@ namespace libtorrent
|
|||
TORRENT_EXTRA_EXPORT int common_bits(unsigned char const* b1
|
||||
, unsigned char const* b2, int n);
|
||||
|
||||
TORRENT_EXTRA_EXPORT address guess_local_address(io_service&);
|
||||
|
||||
typedef boost::function<void(udp::endpoint const& from
|
||||
, char* buffer, int size)> receive_handler_t;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
*/
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/block_cache.hpp"
|
||||
#include "libtorrent/disk_buffer_pool.hpp"
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
@ -193,7 +194,9 @@ const char* const job_action_name[] =
|
|||
"rename_file",
|
||||
"stop_torrent",
|
||||
"cache_piece",
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
"finalize_file",
|
||||
#endif
|
||||
"flush_piece",
|
||||
"flush_hashed",
|
||||
"flush_storage",
|
||||
|
|
|
@ -158,30 +158,6 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
address guess_local_address(io_service& ios)
|
||||
{
|
||||
// make a best guess of the interface we're using and its IP
|
||||
error_code ec;
|
||||
std::vector<ip_interface> const& interfaces = enum_net_interfaces(ios, ec);
|
||||
address ret = address_v4::any();
|
||||
for (std::vector<ip_interface>::const_iterator i = interfaces.begin()
|
||||
, end(interfaces.end()); i != end; ++i)
|
||||
{
|
||||
address const& a = i->interface_address;
|
||||
if (is_loopback(a)
|
||||
|| is_multicast(a)
|
||||
|| is_any(a)) continue;
|
||||
|
||||
// prefer a v4 address, but return a v6 if
|
||||
// there are no v4
|
||||
if (a.is_v4()) return a;
|
||||
|
||||
if (ret != address_v4::any())
|
||||
ret = a;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// count the length of the common bit prefix
|
||||
int common_bits(unsigned char const* b1
|
||||
, unsigned char const* b2, int n)
|
||||
|
|
|
@ -31,8 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include <libtorrent/kademlia/find_data.hpp>
|
||||
#include <libtorrent/kademlia/routing_table.hpp>
|
||||
#include <libtorrent/kademlia/rpc_manager.hpp>
|
||||
#include <libtorrent/kademlia/node.hpp>
|
||||
#include <libtorrent/io.hpp>
|
||||
#include <libtorrent/socket.hpp>
|
||||
|
|
|
@ -49,7 +49,7 @@ void get_item::got_data(bdecode_node const& v,
|
|||
{
|
||||
// we received data!
|
||||
|
||||
std::pair<char const*, int> salt(m_salt.c_str(), m_salt.size());
|
||||
std::pair<char const*, int> salt(m_salt.c_str(), int(m_salt.size()));
|
||||
|
||||
sha1_hash incoming_target;
|
||||
if (pk)
|
||||
|
|
|
@ -203,8 +203,8 @@ bool obfuscated_get_peers::invoke(observer_ptr o)
|
|||
{
|
||||
if (!m_obfuscated) return get_peers::invoke(o);
|
||||
|
||||
node_id id = o->id();
|
||||
int shared_prefix = 160 - distance_exp(id, m_target);
|
||||
const node_id id = o->id();
|
||||
const int shared_prefix = 160 - distance_exp(id, m_target);
|
||||
|
||||
// when we get close to the target zone in the DHT
|
||||
// start using the correct info-hash, in order to
|
||||
|
@ -219,12 +219,12 @@ bool obfuscated_get_peers::invoke(observer_ptr o)
|
|||
for (std::vector<observer_ptr>::iterator i = m_results.begin()
|
||||
, end(m_results.end()); i != end; ++i)
|
||||
{
|
||||
observer* o = i->get();
|
||||
observer* const node = i->get();
|
||||
// don't re-request from nodes that didn't respond
|
||||
if (o->flags & observer::flag_failed) continue;
|
||||
if (node->flags & observer::flag_failed) continue;
|
||||
// don't interrupt with queries that are already in-flight
|
||||
if ((o->flags & observer::flag_alive) == 0) continue;
|
||||
o->flags &= ~(observer::flag_queried | observer::flag_alive);
|
||||
if ((node->flags & observer::flag_alive) == 0) continue;
|
||||
node->flags &= ~(observer::flag_queried | observer::flag_alive);
|
||||
}
|
||||
return get_peers::invoke(o);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
|
||||
#include "libtorrent/kademlia/node_id.hpp"
|
||||
#include "libtorrent/kademlia/node_entry.hpp"
|
||||
|
|
|
@ -45,7 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/ip/host_name.hpp>
|
||||
#include <asio/ip/multicast.hpp>
|
||||
|
@ -61,14 +60,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
namespace libtorrent
|
||||
{
|
||||
// defined in broadcast_socket.cpp
|
||||
address guess_local_address(io_service&);
|
||||
|
||||
namespace {
|
||||
|
||||
int render_lsd_packet(char* dst, int len, int listen_port
|
||||
, char const* info_hash_hex, int m_cookie, char const* host)
|
||||
{
|
||||
TORRENT_ASSERT(len > 0);
|
||||
return snprintf(dst, len,
|
||||
"BT-SEARCH * HTTP/1.1\r\n"
|
||||
"Host: %s:6771\r\n"
|
||||
|
@ -216,7 +213,7 @@ void lsd::resend_announce(error_code const& e, sha1_hash const& info_hash
|
|||
announce_impl(info_hash, listen_port, false, retry_count);
|
||||
}
|
||||
|
||||
void lsd::on_announce(udp::endpoint const& from, char* buffer
|
||||
void lsd::on_announce(udp::endpoint const& from, char* buf
|
||||
, std::size_t bytes_transferred)
|
||||
{
|
||||
using namespace libtorrent::detail;
|
||||
|
@ -224,7 +221,7 @@ void lsd::on_announce(udp::endpoint const& from, char* buffer
|
|||
http_parser p;
|
||||
|
||||
bool error = false;
|
||||
p.incoming(buffer::const_interval(buffer, buffer + bytes_transferred)
|
||||
p.incoming(buffer::const_interval(buf, buf + bytes_transferred)
|
||||
, error);
|
||||
|
||||
if (!p.header_finished() || error)
|
||||
|
|
|
@ -2423,10 +2423,10 @@ namespace libtorrent
|
|||
need_picker();
|
||||
|
||||
const int num_bitmask_bytes = (std::max)(num_blocks_per_piece / 8, 1);
|
||||
if ((int)bitmask.size() != num_bitmask_bytes) continue;
|
||||
if (int(bitmask.size()) != num_bitmask_bytes) continue;
|
||||
for (int k = 0; k < num_bitmask_bytes; ++k)
|
||||
{
|
||||
unsigned char bits = bitmask[k];
|
||||
const unsigned char bits = (unsigned char)bitmask[k];
|
||||
int num_bits = (std::min)(num_blocks_per_piece - k*8, 8);
|
||||
for (int b = 0; b < num_bits; ++b)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue