fix build warnings
This commit is contained in:
parent
e7d369646d
commit
9ee98b3ed1
|
@ -127,8 +127,8 @@ namespace libtorrent {
|
||||||
// Enables alerts for port mapping events. For NAT-PMP and UPnP.
|
// Enables alerts for port mapping events. For NAT-PMP and UPnP.
|
||||||
port_mapping_notification = 0x4,
|
port_mapping_notification = 0x4,
|
||||||
|
|
||||||
// Enables alerts for events related to the storage. File errors and
|
// Enables alerts for events related to the storage. File errors and
|
||||||
// synchronization events for moving the storage, renaming files etc.
|
// synchronization events for moving the storage, renaming files etc.
|
||||||
storage_notification = 0x8,
|
storage_notification = 0x8,
|
||||||
|
|
||||||
// Enables all tracker events. Includes announcing to trackers,
|
// Enables all tracker events. Includes announcing to trackers,
|
||||||
|
@ -145,10 +145,10 @@ namespace libtorrent {
|
||||||
// pieces are completed.
|
// pieces are completed.
|
||||||
progress_notification = 0x80,
|
progress_notification = 0x80,
|
||||||
|
|
||||||
// Alerts when a peer is blocked by the ip blocker or port blocker.
|
// Alerts when a peer is blocked by the ip blocker or port blocker.
|
||||||
ip_block_notification = 0x100,
|
ip_block_notification = 0x100,
|
||||||
|
|
||||||
// Alerts when some limit is reached that might limit the download
|
// Alerts when some limit is reached that might limit the download
|
||||||
// or upload rate.
|
// or upload rate.
|
||||||
performance_warning = 0x200,
|
performance_warning = 0x200,
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ namespace libtorrent {
|
||||||
stats_notification = 0x800,
|
stats_notification = 0x800,
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
// Alerts on RSS related events, like feeds being updated, feed error
|
// Alerts on RSS related events, like feeds being updated, feed error
|
||||||
// conditions and successful RSS feed updates. Enabling this categoty
|
// conditions and successful RSS feed updates. Enabling this categoty
|
||||||
// will make you receive rss_alert alerts.
|
// will make you receive rss_alert alerts.
|
||||||
rss_notification = 0x1000,
|
rss_notification = 0x1000,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace libtorrent
|
||||||
TORRENT_EXTRA_EXPORT std::vector<ip_interface> enum_net_interfaces(io_service& ios
|
TORRENT_EXTRA_EXPORT std::vector<ip_interface> enum_net_interfaces(io_service& ios
|
||||||
, error_code& ec);
|
, error_code& ec);
|
||||||
|
|
||||||
TORRENT_EXTRA_EXPORT std::vector<ip_route> enum_routes(io_service& ios, error_code& ec);
|
TORRENT_EXTRA_EXPORT std::vector<ip_route> enum_routes(error_code& ec);
|
||||||
|
|
||||||
// return (a1 & mask) == (a2 & mask)
|
// return (a1 & mask) == (a2 & mask)
|
||||||
TORRENT_EXTRA_EXPORT bool match_addr_mask(address const& a1
|
TORRENT_EXTRA_EXPORT bool match_addr_mask(address const& a1
|
||||||
|
@ -90,8 +90,7 @@ namespace libtorrent
|
||||||
TORRENT_EXTRA_EXPORT bool in_local_network(std::vector<ip_interface> const& net
|
TORRENT_EXTRA_EXPORT bool in_local_network(std::vector<ip_interface> const& net
|
||||||
, address const& addr);
|
, address const& addr);
|
||||||
|
|
||||||
TORRENT_EXTRA_EXPORT address get_default_gateway(io_service& ios
|
TORRENT_EXTRA_EXPORT address get_default_gateway(error_code& ec);
|
||||||
, error_code& ec);
|
|
||||||
|
|
||||||
#ifdef SO_BINDTODEVICE
|
#ifdef SO_BINDTODEVICE
|
||||||
struct bind_to_device_opt
|
struct bind_to_device_opt
|
||||||
|
|
|
@ -756,8 +756,6 @@ namespace libtorrent
|
||||||
|
|
||||||
void recalc_share_mode();
|
void recalc_share_mode();
|
||||||
|
|
||||||
void update_sparse_piece_prio(int piece, int cursor, int reverse_cursor);
|
|
||||||
|
|
||||||
struct suggest_piece_t
|
struct suggest_piece_t
|
||||||
{
|
{
|
||||||
int piece_index;
|
int piece_index;
|
||||||
|
@ -773,7 +771,7 @@ namespace libtorrent
|
||||||
// we're not super seeding if we're not a seed
|
// we're not super seeding if we're not a seed
|
||||||
return m_super_seeding && is_seed();
|
return m_super_seeding && is_seed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void super_seeding(bool on);
|
void super_seeding(bool on);
|
||||||
int get_piece_to_super_seed(bitfield const&);
|
int get_piece_to_super_seed(bitfield const&);
|
||||||
|
|
||||||
|
@ -870,7 +868,7 @@ namespace libtorrent
|
||||||
void on_name_lookup(error_code const& e
|
void on_name_lookup(error_code const& e
|
||||||
, std::vector<address> const& addrs
|
, std::vector<address> const& addrs
|
||||||
, int port
|
, int port
|
||||||
, std::list<web_seed_t>::iterator web, tcp::endpoint proxy);
|
, std::list<web_seed_t>::iterator web);
|
||||||
|
|
||||||
void connect_web_seed(std::list<web_seed_t>::iterator web, tcp::endpoint a);
|
void connect_web_seed(std::list<web_seed_t>::iterator web, tcp::endpoint a);
|
||||||
|
|
||||||
|
@ -1149,6 +1147,8 @@ namespace libtorrent
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void update_sparse_piece_prio(int piece, int start, int end);
|
||||||
|
|
||||||
void ip_filter_updated();
|
void ip_filter_updated();
|
||||||
|
|
||||||
void inc_stats_counter(int c, int value = 1);
|
void inc_stats_counter(int c, int value = 1);
|
||||||
|
|
|
@ -185,7 +185,7 @@ namespace libtorrent
|
||||||
|
|
||||||
void setup_read(udp::socket* s);
|
void setup_read(udp::socket* s);
|
||||||
void on_read(error_code const& ec, udp::socket* s);
|
void on_read(error_code const& ec, udp::socket* s);
|
||||||
void on_read_impl(udp::socket* sock, udp::endpoint const& ep
|
void on_read_impl(udp::endpoint const& ep
|
||||||
, error_code const& e, std::size_t bytes_transferred);
|
, error_code const& e, std::size_t bytes_transferred);
|
||||||
void on_name_lookup(error_code const& e, tcp::resolver::iterator i);
|
void on_name_lookup(error_code const& e, tcp::resolver::iterator i);
|
||||||
void on_connect_timeout(error_code const& ec);
|
void on_connect_timeout(error_code const& ec);
|
||||||
|
|
|
@ -280,7 +280,7 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TORRENT_USE_IFADDRS
|
#if TORRENT_USE_IFADDRS
|
||||||
bool iface_from_ifaddrs(ifaddrs *ifa, ip_interface &rv, error_code& ec)
|
bool iface_from_ifaddrs(ifaddrs *ifa, ip_interface &rv)
|
||||||
{
|
{
|
||||||
int family = ifa->ifa_addr->sa_family;
|
int family = ifa->ifa_addr->sa_family;
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
// return (a1 & mask) == (a2 & mask)
|
// return (a1 & mask) == (a2 & mask)
|
||||||
bool match_addr_mask(address const& a1, address const& a2, address const& mask)
|
bool match_addr_mask(address const& a1, address const& a2, address const& mask)
|
||||||
{
|
{
|
||||||
|
@ -403,9 +403,10 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<ip_interface> enum_net_interfaces(io_service& ios, error_code& ec)
|
std::vector<ip_interface> enum_net_interfaces(io_service& ios, error_code& ec)
|
||||||
{
|
{
|
||||||
|
TORRENT_UNUSED(ios); // this may be unused depending on configuration
|
||||||
std::vector<ip_interface> ret;
|
std::vector<ip_interface> ret;
|
||||||
#if TORRENT_USE_IFADDRS
|
#if TORRENT_USE_IFADDRS
|
||||||
int s = socket(AF_INET, SOCK_DGRAM, 0);
|
int s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
@ -436,7 +437,7 @@ namespace libtorrent
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ip_interface iface;
|
ip_interface iface;
|
||||||
if (iface_from_ifaddrs(ifa, iface, ec))
|
if (iface_from_ifaddrs(ifa, iface))
|
||||||
{
|
{
|
||||||
ifreq req;
|
ifreq req;
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof(req));
|
||||||
|
@ -618,7 +619,7 @@ namespace libtorrent
|
||||||
|
|
||||||
INTERFACE_INFO buffer[30];
|
INTERFACE_INFO buffer[30];
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
if (WSAIoctl(s, SIO_GET_INTERFACE_LIST, 0, 0, buffer,
|
if (WSAIoctl(s, SIO_GET_INTERFACE_LIST, 0, 0, buffer,
|
||||||
sizeof(buffer), &size, 0, 0) != 0)
|
sizeof(buffer), &size, 0, 0) != 0)
|
||||||
{
|
{
|
||||||
|
@ -667,9 +668,9 @@ namespace libtorrent
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
address get_default_gateway(io_service& ios, error_code& ec)
|
address get_default_gateway(error_code& ec)
|
||||||
{
|
{
|
||||||
std::vector<ip_route> ret = enum_routes(ios, ec);
|
std::vector<ip_route> ret = enum_routes(ec);
|
||||||
#if defined TORRENT_WINDOWS || defined TORRENT_MINGW
|
#if defined TORRENT_WINDOWS || defined TORRENT_MINGW
|
||||||
std::vector<ip_route>::iterator i = std::find_if(ret.begin(), ret.end()
|
std::vector<ip_route>::iterator i = std::find_if(ret.begin(), ret.end()
|
||||||
, boost::bind(&is_loopback, boost::bind(&ip_route::destination, _1)));
|
, boost::bind(&is_loopback, boost::bind(&ip_route::destination, _1)));
|
||||||
|
@ -681,10 +682,10 @@ namespace libtorrent
|
||||||
return i->gateway;
|
return i->gateway;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ip_route> enum_routes(io_service& ios, error_code& ec)
|
std::vector<ip_route> enum_routes(error_code& ec)
|
||||||
{
|
{
|
||||||
std::vector<ip_route> ret;
|
std::vector<ip_route> ret;
|
||||||
|
|
||||||
#if TORRENT_USE_SYSCTL
|
#if TORRENT_USE_SYSCTL
|
||||||
/*
|
/*
|
||||||
struct rt_msg
|
struct rt_msg
|
||||||
|
@ -835,12 +836,12 @@ namespace libtorrent
|
||||||
rtm = (rt_msghdr*)next;
|
rtm = (rt_msghdr*)next;
|
||||||
if (rtm->rtm_version != RTM_VERSION)
|
if (rtm->rtm_version != RTM_VERSION)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ip_route r;
|
ip_route r;
|
||||||
if (parse_route(s, rtm, &r)) ret.push_back(r);
|
if (parse_route(s, rtm, &r)) ret.push_back(r);
|
||||||
}
|
}
|
||||||
close(s);
|
close(s);
|
||||||
|
|
||||||
#elif TORRENT_USE_GETIPFORWARDTABLE
|
#elif TORRENT_USE_GETIPFORWARDTABLE
|
||||||
/*
|
/*
|
||||||
move this to enum_net_interfaces
|
move this to enum_net_interfaces
|
||||||
|
@ -925,7 +926,7 @@ namespace libtorrent
|
||||||
typedef DWORD (WINAPI *GetIpForwardTable2_t)(
|
typedef DWORD (WINAPI *GetIpForwardTable2_t)(
|
||||||
ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
|
ADDRESS_FAMILY, PMIB_IPFORWARD_TABLE2*);
|
||||||
typedef void (WINAPI *FreeMibTable_t)(PVOID Memory);
|
typedef void (WINAPI *FreeMibTable_t)(PVOID Memory);
|
||||||
|
|
||||||
GetIpForwardTable2_t GetIpForwardTable2 = (GetIpForwardTable2_t)GetProcAddress(
|
GetIpForwardTable2_t GetIpForwardTable2 = (GetIpForwardTable2_t)GetProcAddress(
|
||||||
iphlp, "GetIpForwardTable2");
|
iphlp, "GetIpForwardTable2");
|
||||||
FreeMibTable_t FreeMibTable = (FreeMibTable_t)GetProcAddress(
|
FreeMibTable_t FreeMibTable = (FreeMibTable_t)GetProcAddress(
|
||||||
|
@ -962,7 +963,7 @@ namespace libtorrent
|
||||||
|
|
||||||
// Get GetIpForwardTable() pointer
|
// Get GetIpForwardTable() pointer
|
||||||
typedef DWORD (WINAPI *GetIpForwardTable_t)(PMIB_IPFORWARDTABLE pIpForwardTable,PULONG pdwSize,BOOL bOrder);
|
typedef DWORD (WINAPI *GetIpForwardTable_t)(PMIB_IPFORWARDTABLE pIpForwardTable,PULONG pdwSize,BOOL bOrder);
|
||||||
|
|
||||||
GetIpForwardTable_t GetIpForwardTable = (GetIpForwardTable_t)GetProcAddress(
|
GetIpForwardTable_t GetIpForwardTable = (GetIpForwardTable_t)GetProcAddress(
|
||||||
iphlp, "GetIpForwardTable");
|
iphlp, "GetIpForwardTable");
|
||||||
if (!GetIpForwardTable)
|
if (!GetIpForwardTable)
|
||||||
|
|
|
@ -88,7 +88,7 @@ void natpmp::start()
|
||||||
mutex::scoped_lock l(m_mutex);
|
mutex::scoped_lock l(m_mutex);
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
address gateway = get_default_gateway(m_socket.get_io_service(), ec);
|
address gateway = get_default_gateway(ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
char msg[200];
|
char msg[200];
|
||||||
|
|
|
@ -159,7 +159,7 @@ namespace libtorrent
|
||||||
++i;
|
++i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int current = i - m_peers.begin();
|
int current = i - m_peers.begin();
|
||||||
TORRENT_ASSERT(current >= 0);
|
TORRENT_ASSERT(current >= 0);
|
||||||
TORRENT_ASSERT(m_peers.size() > 0);
|
TORRENT_ASSERT(m_peers.size() > 0);
|
||||||
|
@ -171,7 +171,7 @@ namespace libtorrent
|
||||||
// peer_info_struct. If that is the case, just continue
|
// peer_info_struct. If that is the case, just continue
|
||||||
size_t count = m_peers.size();
|
size_t count = m_peers.size();
|
||||||
peer_connection_interface* p = (*i)->connection;
|
peer_connection_interface* p = (*i)->connection;
|
||||||
|
|
||||||
banned.push_back(p->remote().address());
|
banned.push_back(p->remote().address());
|
||||||
|
|
||||||
p->disconnect(errors::banned_by_ip_filter
|
p->disconnect(errors::banned_by_ip_filter
|
||||||
|
@ -221,7 +221,7 @@ namespace libtorrent
|
||||||
++i;
|
++i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int current = i - m_peers.begin();
|
int current = i - m_peers.begin();
|
||||||
TORRENT_ASSERT(current >= 0);
|
TORRENT_ASSERT(current >= 0);
|
||||||
TORRENT_ASSERT(m_peers.size() > 0);
|
TORRENT_ASSERT(m_peers.size() > 0);
|
||||||
|
@ -233,7 +233,7 @@ namespace libtorrent
|
||||||
// peer_info_struct. If that is the case, just continue
|
// peer_info_struct. If that is the case, just continue
|
||||||
int count = m_peers.size();
|
int count = m_peers.size();
|
||||||
peer_connection_interface* p = (*i)->connection;
|
peer_connection_interface* p = (*i)->connection;
|
||||||
|
|
||||||
banned.push_back(p->remote().address());
|
banned.push_back(p->remote().address());
|
||||||
|
|
||||||
p->disconnect(errors::banned_by_port_filter, op_bittorrent);
|
p->disconnect(errors::banned_by_port_filter, op_bittorrent);
|
||||||
|
@ -389,7 +389,7 @@ namespace libtorrent
|
||||||
|
|
||||||
++round_robin;
|
++round_robin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (erase_candidate > -1)
|
if (erase_candidate > -1)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(erase_candidate >= 0 && erase_candidate < int(m_peers.size()));
|
TORRENT_ASSERT(erase_candidate >= 0 && erase_candidate < int(m_peers.size()));
|
||||||
|
@ -467,7 +467,7 @@ namespace libtorrent
|
||||||
|| (p.seed && m_finished)
|
|| (p.seed && m_finished)
|
||||||
|| int(p.failcount) >= m_max_failcount)
|
|| int(p.failcount) >= m_max_failcount)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ namespace libtorrent
|
||||||
|
|
||||||
peers.insert(i, &pe);
|
peers.insert(i, &pe);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (erase_candidate > -1)
|
if (erase_candidate > -1)
|
||||||
{
|
{
|
||||||
erase_peer(m_peers.begin() + erase_candidate, state);
|
erase_peer(m_peers.begin() + erase_candidate, state);
|
||||||
|
@ -581,7 +581,7 @@ namespace libtorrent
|
||||||
tcp::endpoint remote = c.remote();
|
tcp::endpoint remote = c.remote();
|
||||||
std::pair<iterator, iterator> range = find_peers(remote.address());
|
std::pair<iterator, iterator> range = find_peers(remote.address());
|
||||||
iter = std::find_if(range.first, range.second, match_peer_endpoint(remote));
|
iter = std::find_if(range.first, range.second, match_peer_endpoint(remote));
|
||||||
|
|
||||||
if (iter != range.second)
|
if (iter != range.second)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT((*iter)->in_use);
|
TORRENT_ASSERT((*iter)->in_use);
|
||||||
|
@ -766,10 +766,10 @@ namespace libtorrent
|
||||||
if (m_round_robin >= iter - m_peers.begin()) ++m_round_robin;
|
if (m_round_robin >= iter - m_peers.begin()) ++m_round_robin;
|
||||||
|
|
||||||
i = *iter;
|
i = *iter;
|
||||||
|
|
||||||
i->source = peer_info::incoming;
|
i->source = peer_info::incoming;
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_ASSERT(i);
|
TORRENT_ASSERT(i);
|
||||||
c.set_peer_info(i);
|
c.set_peer_info(i);
|
||||||
TORRENT_ASSERT(i->connection == 0);
|
TORRENT_ASSERT(i->connection == 0);
|
||||||
|
|
|
@ -4027,8 +4027,8 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(m_picker);
|
TORRENT_ASSERT(m_picker);
|
||||||
if (m_picker->have_piece(i) || m_picker->piece_priority(i) == 0)
|
if (m_picker->have_piece(i) || m_picker->piece_priority(i) == 0)
|
||||||
return;
|
return;
|
||||||
bool have_before = i == 0 || m_picker->have_piece(i - 1);
|
bool have_before = i < start || m_picker->have_piece(i - 1);
|
||||||
bool have_after = i == end - 1 || m_picker->have_piece(i + 1);
|
bool have_after = i >= end || m_picker->have_piece(i + 1);
|
||||||
if (have_after && have_before)
|
if (have_after && have_before)
|
||||||
m_picker->set_piece_priority(i, 7);
|
m_picker->set_piece_priority(i, 7);
|
||||||
else if (have_after || have_before)
|
else if (have_after || have_before)
|
||||||
|
@ -4281,7 +4281,7 @@ namespace libtorrent
|
||||||
std::vector<int>::iterator i = std::lower_bound(m_predictive_pieces.begin()
|
std::vector<int>::iterator i = std::lower_bound(m_predictive_pieces.begin()
|
||||||
, m_predictive_pieces.end(), index);
|
, m_predictive_pieces.end(), index);
|
||||||
if (i != m_predictive_pieces.end() && *i == index) return;
|
if (i != m_predictive_pieces.end() && *i == index) return;
|
||||||
|
|
||||||
for (peer_iterator p = m_connections.begin()
|
for (peer_iterator p = m_connections.begin()
|
||||||
, end(m_connections.end()); p != end; ++p)
|
, end(m_connections.end()); p != end; ++p)
|
||||||
{
|
{
|
||||||
|
@ -4307,7 +4307,7 @@ namespace libtorrent
|
||||||
|
|
||||||
TORRENT_ASSERT(m_picker.get());
|
TORRENT_ASSERT(m_picker.get());
|
||||||
TORRENT_ASSERT(index >= 0);
|
TORRENT_ASSERT(index >= 0);
|
||||||
TORRENT_ASSERT(index < m_torrent_file->num_pieces());
|
TORRENT_ASSERT(index < m_torrent_file->num_pieces());
|
||||||
|
|
||||||
inc_stats_counter(counters::num_piece_failed);
|
inc_stats_counter(counters::num_piece_failed);
|
||||||
|
|
||||||
|
@ -6145,7 +6145,7 @@ namespace libtorrent
|
||||||
web->resolving = true;
|
web->resolving = true;
|
||||||
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
|
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
|
||||||
, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
|
, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
|
||||||
, port, web, tcp::endpoint()));
|
, port, web));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6228,14 +6228,13 @@ namespace libtorrent
|
||||||
web->resolving = true;
|
web->resolving = true;
|
||||||
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
|
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
|
||||||
, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
|
, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
|
||||||
, port, web, a));
|
, port, web));
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::on_name_lookup(error_code const& e
|
void torrent::on_name_lookup(error_code const& e
|
||||||
, std::vector<address> const& addrs
|
, std::vector<address> const& addrs
|
||||||
, int port
|
, int port
|
||||||
, std::list<web_seed_t>::iterator web
|
, std::list<web_seed_t>::iterator web)
|
||||||
, tcp::endpoint proxy)
|
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
|
|
||||||
|
@ -6303,7 +6302,7 @@ namespace libtorrent
|
||||||
, a.address(), peer_blocked_alert::ip_filter);
|
, a.address(), peer_blocked_alert::ip_filter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_ASSERT(web->resolving == false);
|
TORRENT_ASSERT(web->resolving == false);
|
||||||
TORRENT_ASSERT(web->peer_info.connection == 0);
|
TORRENT_ASSERT(web->peer_info.connection == 0);
|
||||||
|
|
||||||
|
@ -6319,7 +6318,7 @@ namespace libtorrent
|
||||||
boost::shared_ptr<socket_type> s
|
boost::shared_ptr<socket_type> s
|
||||||
= boost::make_shared<socket_type>(boost::ref(m_ses.get_io_service()));
|
= boost::make_shared<socket_type>(boost::ref(m_ses.get_io_service()));
|
||||||
if (!s) return;
|
if (!s) return;
|
||||||
|
|
||||||
void* userdata = 0;
|
void* userdata = 0;
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
bool ssl = string_begins_no_case("https://", web->url.c_str());
|
bool ssl = string_begins_no_case("https://", web->url.c_str());
|
||||||
|
@ -9962,7 +9961,6 @@ namespace libtorrent
|
||||||
|
|
||||||
int num_pieces = m_torrent_file->num_pieces();
|
int num_pieces = m_torrent_file->num_pieces();
|
||||||
int rarest_rarity = INT_MAX;
|
int rarest_rarity = INT_MAX;
|
||||||
bool prio_updated = false;
|
|
||||||
for (int i = 0; i < num_pieces; ++i)
|
for (int i = 0; i < num_pieces; ++i)
|
||||||
{
|
{
|
||||||
piece_picker::piece_stats_t ps = m_picker->piece_stats(i);
|
piece_picker::piece_stats_t ps = m_picker->piece_stats(i);
|
||||||
|
@ -9970,7 +9968,6 @@ namespace libtorrent
|
||||||
if (ps.priority == 0 && (ps.have || ps.downloading))
|
if (ps.priority == 0 && (ps.have || ps.downloading))
|
||||||
{
|
{
|
||||||
m_picker->set_piece_priority(i, 1);
|
m_picker->set_piece_priority(i, 1);
|
||||||
prio_updated = true;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// don't count pieces we already have or are trying to download
|
// don't count pieces we already have or are trying to download
|
||||||
|
@ -10859,7 +10856,7 @@ namespace libtorrent
|
||||||
|
|
||||||
need_policy();
|
need_policy();
|
||||||
torrent_state st = get_policy_state();
|
torrent_state st = get_policy_state();
|
||||||
torrent_peer* p = m_peer_list->add_peer(adr, source, 0, &st);
|
torrent_peer* p = m_peer_list->add_peer(adr, source, flags, &st);
|
||||||
peers_erased(st.erased);
|
peers_erased(st.erased);
|
||||||
if (p)
|
if (p)
|
||||||
{
|
{
|
||||||
|
@ -11123,7 +11120,7 @@ namespace libtorrent
|
||||||
fp.resize(m_torrent_file->num_files(), 0);
|
fp.resize(m_torrent_file->num_files(), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int num_files = m_torrent_file->num_files();
|
int num_files = m_torrent_file->num_files();
|
||||||
if (m_file_progress.empty())
|
if (m_file_progress.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -302,7 +302,7 @@ void udp_socket::on_read(error_code const& ec, udp::socket* s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ec == asio::error::would_block || ec == asio::error::try_again) break;
|
if (ec == asio::error::would_block || ec == asio::error::try_again) break;
|
||||||
on_read_impl(s, ep, ec, bytes_transferred);
|
on_read_impl(ep, ec, bytes_transferred);
|
||||||
}
|
}
|
||||||
call_drained_handler();
|
call_drained_handler();
|
||||||
setup_read(s);
|
setup_read(s);
|
||||||
|
@ -419,7 +419,7 @@ void udp_socket::unsubscribe(udp_socket_observer* o)
|
||||||
m_observers.erase(i);
|
m_observers.erase(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void udp_socket::on_read_impl(udp::socket* s, udp::endpoint const& ep
|
void udp_socket::on_read_impl(udp::endpoint const& ep
|
||||||
, error_code const& e, std::size_t bytes_transferred)
|
, error_code const& e, std::size_t bytes_transferred)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_magic == 0x1337);
|
TORRENT_ASSERT(m_magic == 0x1337);
|
||||||
|
|
|
@ -401,12 +401,12 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
||||||
}
|
}
|
||||||
log(msg, l);
|
log(msg, l);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool non_router = false;
|
bool non_router = false;
|
||||||
if (m_ignore_non_routers)
|
if (m_ignore_non_routers)
|
||||||
{
|
{
|
||||||
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
|
std::vector<ip_route> routes = enum_routes(ec);
|
||||||
if (std::find_if(routes.begin(), routes.end()
|
if (std::find_if(routes.begin(), routes.end()
|
||||||
, boost::bind(&ip_route::gateway, _1) == from.address()) == routes.end())
|
, boost::bind(&ip_route::gateway, _1) == from.address()) == routes.end())
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
m_last_route_update = aux::time_now();
|
m_last_route_update = aux::time_now();
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_routes = enum_routes(m_sock.get_io_service(), ec);
|
m_routes = enum_routes(ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mtu = 0;
|
int mtu = 0;
|
||||||
|
@ -206,7 +206,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
m_last_route_update = aux::time_now();
|
m_last_route_update = aux::time_now();
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_routes = enum_routes(m_sock.get_io_service(), ec);
|
m_routes = enum_routes(ec);
|
||||||
if (ec) return socket_ep;
|
if (ec) return socket_ep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ int test_main()
|
||||||
std::vector<char> piece(128 * 1024);
|
std::vector<char> piece(128 * 1024);
|
||||||
for (int i = 0; i < int(piece.size()); ++i)
|
for (int i = 0; i < int(piece.size()); ++i)
|
||||||
piece[i] = (i % 26) + 'A';
|
piece[i] = (i % 26) + 'A';
|
||||||
|
|
||||||
// calculate the hash for all pieces
|
// calculate the hash for all pieces
|
||||||
sha1_hash ph = hasher(&piece[0], piece.size()).final();
|
sha1_hash ph = hasher(&piece[0], piece.size()).final();
|
||||||
int num = t.num_pieces();
|
int num = t.num_pieces();
|
||||||
|
@ -229,7 +229,7 @@ int test_main()
|
||||||
initialize_file_progress(fp, picker, fs);
|
initialize_file_progress(fp, picker, fs);
|
||||||
|
|
||||||
boost::uint64_t sum = 0;
|
boost::uint64_t sum = 0;
|
||||||
for (int i = 0; i < fp.size(); ++i)
|
for (int i = 0; i < int(fp.size()); ++i)
|
||||||
sum += fp[i];
|
sum += fp[i];
|
||||||
|
|
||||||
TEST_EQUAL(sum, fs.piece_size(idx));
|
TEST_EQUAL(sum, fs.piece_size(idx));
|
||||||
|
|
Loading…
Reference in New Issue