forked from premiere/premiere-libtorrent
fixed vs 2010 build
This commit is contained in:
parent
d441c7eab2
commit
dce2edb6cc
|
@ -28,6 +28,7 @@
|
||||||
incoming connection
|
incoming connection
|
||||||
* added more detailed instrumentation of the disk I/O thread
|
* added more detailed instrumentation of the disk I/O thread
|
||||||
|
|
||||||
|
* fixed vs 2010 build
|
||||||
* recognizes more clients in identify_client()
|
* recognizes more clients in identify_client()
|
||||||
* fixed bug where trackers wouldn't be retried if they failed
|
* fixed bug where trackers wouldn't be retried if they failed
|
||||||
* slight performance fix in disk elevator algorithm
|
* slight performance fix in disk elevator algorithm
|
||||||
|
|
|
@ -259,7 +259,7 @@ namespace libtorrent
|
||||||
m_sockets.push_back(socket_entry(s));
|
m_sockets.push_back(socket_entry(s));
|
||||||
socket_entry& se = m_sockets.back();
|
socket_entry& se = m_sockets.back();
|
||||||
s->async_receive_from(asio::buffer(se.buffer, sizeof(se.buffer))
|
s->async_receive_from(asio::buffer(se.buffer, sizeof(se.buffer))
|
||||||
, se.remote, bind(&broadcast_socket::on_receive, this, &se, _1, _2));
|
, se.remote, boost::bind(&broadcast_socket::on_receive, this, &se, _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void broadcast_socket::open_unicast_socket(io_service& ios, address const& addr
|
void broadcast_socket::open_unicast_socket(io_service& ios, address const& addr
|
||||||
|
@ -275,7 +275,7 @@ namespace libtorrent
|
||||||
m_unicast_sockets.push_back(socket_entry(s, mask));
|
m_unicast_sockets.push_back(socket_entry(s, mask));
|
||||||
socket_entry& se = m_unicast_sockets.back();
|
socket_entry& se = m_unicast_sockets.back();
|
||||||
s->async_receive_from(asio::buffer(se.buffer, sizeof(se.buffer))
|
s->async_receive_from(asio::buffer(se.buffer, sizeof(se.buffer))
|
||||||
, se.remote, bind(&broadcast_socket::on_receive, this, &se, _1, _2));
|
, se.remote, boost::bind(&broadcast_socket::on_receive, this, &se, _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void broadcast_socket::send(char const* buffer, int size, error_code& ec)
|
void broadcast_socket::send(char const* buffer, int size, error_code& ec)
|
||||||
|
@ -333,13 +333,13 @@ namespace libtorrent
|
||||||
m_on_receive(s->remote, s->buffer, bytes_transferred);
|
m_on_receive(s->remote, s->buffer, bytes_transferred);
|
||||||
if (!s->socket) return;
|
if (!s->socket) return;
|
||||||
s->socket->async_receive_from(asio::buffer(s->buffer, sizeof(s->buffer))
|
s->socket->async_receive_from(asio::buffer(s->buffer, sizeof(s->buffer))
|
||||||
, s->remote, bind(&broadcast_socket::on_receive, this, s, _1, _2));
|
, s->remote, boost::bind(&broadcast_socket::on_receive, this, s, _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void broadcast_socket::close()
|
void broadcast_socket::close()
|
||||||
{
|
{
|
||||||
std::for_each(m_sockets.begin(), m_sockets.end(), bind(&socket_entry::close, _1));
|
std::for_each(m_sockets.begin(), m_sockets.end(), boost::bind(&socket_entry::close, _1));
|
||||||
std::for_each(m_unicast_sockets.begin(), m_unicast_sockets.end(), bind(&socket_entry::close, _1));
|
std::for_each(m_unicast_sockets.begin(), m_unicast_sockets.end(), boost::bind(&socket_entry::close, _1));
|
||||||
|
|
||||||
m_on_receive.clear();
|
m_on_receive.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/hasher.hpp"
|
#include "libtorrent/hasher.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
||||||
|
|
|
@ -422,7 +422,6 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
m_urls.push_back(announce_entry(url, tier));
|
m_urls.push_back(announce_entry(url, tier));
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
std::sort(m_urls.begin(), m_urls.end()
|
std::sort(m_urls.begin(), m_urls.end()
|
||||||
, boost::bind(&announce_entry::second, _1) < boost::bind(&announce_entry::second, _2));
|
, boost::bind(&announce_entry::second, _1) < boost::bind(&announce_entry::second, _2));
|
||||||
}
|
}
|
||||||
|
|
|
@ -674,8 +674,8 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
cache_lru_index_t::iterator i =
|
cache_lru_index_t::iterator i =
|
||||||
std::max_element(idx.begin(), idx.end()
|
std::max_element(idx.begin(), idx.end()
|
||||||
, bind(&contiguous_blocks, _1)
|
, boost::bind(&contiguous_blocks, _1)
|
||||||
< bind(&contiguous_blocks, _2));
|
< boost::bind(&contiguous_blocks, _2));
|
||||||
if (i == idx.end()) return ret;
|
if (i == idx.end()) return ret;
|
||||||
tmp = flush_contiguous_blocks(const_cast<cached_piece_entry&>(*i), l);
|
tmp = flush_contiguous_blocks(const_cast<cached_piece_entry&>(*i), l);
|
||||||
if (i->num_blocks == 0) idx.erase(i);
|
if (i->num_blocks == 0) idx.erase(i);
|
||||||
|
|
|
@ -42,8 +42,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
enum { max_bottled_buffer = 1024 * 1024 };
|
enum { max_bottled_buffer = 1024 * 1024 };
|
||||||
|
@ -163,7 +161,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
|
||||||
m_timeout = timeout;
|
m_timeout = timeout;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_timer.expires_from_now(m_timeout, ec);
|
m_timer.expires_from_now(m_timeout, ec);
|
||||||
m_timer.async_wait(bind(&http_connection::on_timeout
|
m_timer.async_wait(boost::bind(&http_connection::on_timeout
|
||||||
, boost::weak_ptr<http_connection>(shared_from_this()), _1));
|
, boost::weak_ptr<http_connection>(shared_from_this()), _1));
|
||||||
m_called = false;
|
m_called = false;
|
||||||
m_parser.reset();
|
m_parser.reset();
|
||||||
|
@ -186,7 +184,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
|
||||||
&& m_ssl == ssl && m_bind_addr == bind_addr)
|
&& m_ssl == ssl && m_bind_addr == bind_addr)
|
||||||
{
|
{
|
||||||
async_write(m_sock, asio::buffer(sendbuffer)
|
async_write(m_sock, asio::buffer(sendbuffer)
|
||||||
, bind(&http_connection::on_write, shared_from_this(), _1));
|
, boost::bind(&http_connection::on_write, shared_from_this(), _1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -293,14 +291,14 @@ void http_connection::start(std::string const& hostname, std::string const& port
|
||||||
#if TORRENT_USE_I2P
|
#if TORRENT_USE_I2P
|
||||||
if (is_i2p)
|
if (is_i2p)
|
||||||
{
|
{
|
||||||
i2p_conn->async_name_lookup(hostname.c_str(), bind(&http_connection::on_i2p_resolve
|
i2p_conn->async_name_lookup(hostname.c_str(), boost::bind(&http_connection::on_i2p_resolve
|
||||||
, shared_from_this(), _1, _2));
|
, shared_from_this(), _1, _2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
tcp::resolver::query query(hostname, port);
|
tcp::resolver::query query(hostname, port);
|
||||||
m_resolver.async_resolve(query, bind(&http_connection::on_resolve
|
m_resolver.async_resolve(query, boost::bind(&http_connection::on_resolve
|
||||||
, shared_from_this(), _1, _2));
|
, shared_from_this(), _1, _2));
|
||||||
}
|
}
|
||||||
m_hostname = hostname;
|
m_hostname = hostname;
|
||||||
|
@ -344,7 +342,7 @@ void http_connection::on_timeout(boost::weak_ptr<http_connection> p
|
||||||
error_code ec;
|
error_code ec;
|
||||||
c->m_sock.close(ec);
|
c->m_sock.close(ec);
|
||||||
c->m_timer.expires_at(c->m_last_receive + c->m_timeout, ec);
|
c->m_timer.expires_at(c->m_last_receive + c->m_timeout, ec);
|
||||||
c->m_timer.async_wait(bind(&http_connection::on_timeout, p, _1));
|
c->m_timer.async_wait(boost::bind(&http_connection::on_timeout, p, _1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -357,7 +355,7 @@ void http_connection::on_timeout(boost::weak_ptr<http_connection> p
|
||||||
if (!c->m_sock.is_open()) return;
|
if (!c->m_sock.is_open()) return;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
c->m_timer.expires_at(c->m_last_receive + c->m_timeout, ec);
|
c->m_timer.expires_at(c->m_last_receive + c->m_timeout, ec);
|
||||||
c->m_timer.async_wait(bind(&http_connection::on_timeout, p, _1));
|
c->m_timer.async_wait(boost::bind(&http_connection::on_timeout, p, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void http_connection::close()
|
void http_connection::close()
|
||||||
|
@ -446,8 +444,8 @@ void http_connection::queue_connect()
|
||||||
tcp::endpoint target = m_endpoints.front();
|
tcp::endpoint target = m_endpoints.front();
|
||||||
m_endpoints.pop_front();
|
m_endpoints.pop_front();
|
||||||
|
|
||||||
m_cc.enqueue(bind(&http_connection::connect, shared_from_this(), _1, target)
|
m_cc.enqueue(boost::bind(&http_connection::connect, shared_from_this(), _1, target)
|
||||||
, bind(&http_connection::on_connect_timeout, shared_from_this())
|
, boost::bind(&http_connection::on_connect_timeout, shared_from_this())
|
||||||
, m_timeout, m_priority);
|
, m_timeout, m_priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +469,7 @@ void http_connection::on_connect(error_code const& e)
|
||||||
{
|
{
|
||||||
if (m_connect_handler) m_connect_handler(*this);
|
if (m_connect_handler) m_connect_handler(*this);
|
||||||
async_write(m_sock, asio::buffer(sendbuffer)
|
async_write(m_sock, asio::buffer(sendbuffer)
|
||||||
, bind(&http_connection::on_write, shared_from_this(), _1));
|
, boost::bind(&http_connection::on_write, shared_from_this(), _1));
|
||||||
}
|
}
|
||||||
else if (!m_endpoints.empty() && !m_abort)
|
else if (!m_endpoints.empty() && !m_abort)
|
||||||
{
|
{
|
||||||
|
@ -541,7 +539,7 @@ void http_connection::on_write(error_code const& e)
|
||||||
}
|
}
|
||||||
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
|
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
|
||||||
, amount_to_read)
|
, amount_to_read)
|
||||||
, bind(&http_connection::on_read
|
, boost::bind(&http_connection::on_read
|
||||||
, shared_from_this(), _1, _2));
|
, shared_from_this(), _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +691,7 @@ void http_connection::on_read(error_code const& e
|
||||||
}
|
}
|
||||||
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
|
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
|
||||||
, amount_to_read)
|
, amount_to_read)
|
||||||
, bind(&http_connection::on_read
|
, boost::bind(&http_connection::on_read
|
||||||
, me, _1, _2));
|
, me, _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,13 +719,13 @@ void http_connection::on_assign_bandwidth(error_code const& e)
|
||||||
|
|
||||||
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
|
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
|
||||||
, amount_to_read)
|
, amount_to_read)
|
||||||
, bind(&http_connection::on_read
|
, boost::bind(&http_connection::on_read
|
||||||
, shared_from_this(), _1, _2));
|
, shared_from_this(), _1, _2));
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_limiter_timer_active = true;
|
m_limiter_timer_active = true;
|
||||||
m_limiter_timer.expires_from_now(milliseconds(250), ec);
|
m_limiter_timer.expires_from_now(milliseconds(250), ec);
|
||||||
m_limiter_timer.async_wait(bind(&http_connection::on_assign_bandwidth
|
m_limiter_timer.async_wait(boost::bind(&http_connection::on_assign_bandwidth
|
||||||
, shared_from_this(), _1));
|
, shared_from_this(), _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +738,7 @@ void http_connection::rate_limit(int limit)
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_limiter_timer_active = true;
|
m_limiter_timer_active = true;
|
||||||
m_limiter_timer.expires_from_now(milliseconds(250), ec);
|
m_limiter_timer.expires_from_now(milliseconds(250), ec);
|
||||||
m_limiter_timer.async_wait(bind(&http_connection::on_assign_bandwidth
|
m_limiter_timer.async_wait(boost::bind(&http_connection::on_assign_bandwidth
|
||||||
, shared_from_this(), _1));
|
, shared_from_this(), _1));
|
||||||
}
|
}
|
||||||
m_rate_limit = limit;
|
m_rate_limit = limit;
|
||||||
|
|
|
@ -49,7 +49,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/parse_url.hpp"
|
#include "libtorrent/parse_url.hpp"
|
||||||
#include "libtorrent/peer_info.hpp"
|
#include "libtorrent/peer_info.hpp"
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/aux_/session_impl.hpp"
|
#include "libtorrent/aux_/session_impl.hpp"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
|
@ -223,8 +223,6 @@ namespace libtorrent { namespace dht
|
||||||
, m_received_bytes(0)
|
, m_received_bytes(0)
|
||||||
, m_refs(0)
|
, m_refs(0)
|
||||||
{
|
{
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||||
m_counter = 0;
|
m_counter = 0;
|
||||||
std::fill_n(m_replies_bytes_sent, 5, 0);
|
std::fill_n(m_replies_bytes_sent, 5, 0);
|
||||||
|
@ -269,14 +267,14 @@ namespace libtorrent { namespace dht
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_timer.expires_from_now(seconds(1), ec);
|
m_timer.expires_from_now(seconds(1), ec);
|
||||||
m_timer.async_wait(bind(&dht_tracker::tick, self(), _1));
|
m_timer.async_wait(boost::bind(&dht_tracker::tick, self(), _1));
|
||||||
|
|
||||||
m_connection_timer.expires_from_now(seconds(10), ec);
|
m_connection_timer.expires_from_now(seconds(10), ec);
|
||||||
m_connection_timer.async_wait(
|
m_connection_timer.async_wait(
|
||||||
bind(&dht_tracker::connection_timeout, self(), _1));
|
boost::bind(&dht_tracker::connection_timeout, self(), _1));
|
||||||
|
|
||||||
m_refresh_timer.expires_from_now(seconds(5), ec);
|
m_refresh_timer.expires_from_now(seconds(5), ec);
|
||||||
m_refresh_timer.async_wait(bind(&dht_tracker::refresh_timeout, self(), _1));
|
m_refresh_timer.async_wait(boost::bind(&dht_tracker::refresh_timeout, self(), _1));
|
||||||
m_dht.bootstrap(initial_nodes, boost::bind(&dht_tracker::on_bootstrap, self(), _1));
|
m_dht.bootstrap(initial_nodes, boost::bind(&dht_tracker::on_bootstrap, self(), _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +312,7 @@ namespace libtorrent { namespace dht
|
||||||
time_duration d = m_dht.connection_timeout();
|
time_duration d = m_dht.connection_timeout();
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_connection_timer.expires_from_now(d, ec);
|
m_connection_timer.expires_from_now(d, ec);
|
||||||
m_connection_timer.async_wait(bind(&dht_tracker::connection_timeout, self(), _1));
|
m_connection_timer.async_wait(boost::bind(&dht_tracker::connection_timeout, self(), _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dht_tracker::refresh_timeout(error_code const& e)
|
void dht_tracker::refresh_timeout(error_code const& e)
|
||||||
|
@ -326,7 +324,7 @@ namespace libtorrent { namespace dht
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_refresh_timer.expires_from_now(seconds(5), ec);
|
m_refresh_timer.expires_from_now(seconds(5), ec);
|
||||||
m_refresh_timer.async_wait(
|
m_refresh_timer.async_wait(
|
||||||
bind(&dht_tracker::refresh_timeout, self(), _1));
|
boost::bind(&dht_tracker::refresh_timeout, self(), _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dht_tracker::tick(error_code const& e)
|
void dht_tracker::tick(error_code const& e)
|
||||||
|
@ -336,7 +334,7 @@ namespace libtorrent { namespace dht
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_timer.expires_from_now(minutes(tick_period), ec);
|
m_timer.expires_from_now(minutes(tick_period), ec);
|
||||||
m_timer.async_wait(bind(&dht_tracker::tick, self(), _1));
|
m_timer.async_wait(boost::bind(&dht_tracker::tick, self(), _1));
|
||||||
|
|
||||||
ptime now = time_now();
|
ptime now = time_now();
|
||||||
if (now - m_last_new_key > minutes(key_refresh))
|
if (now - m_last_new_key > minutes(key_refresh))
|
||||||
|
@ -589,7 +587,7 @@ namespace libtorrent { namespace dht
|
||||||
snprintf(port, sizeof(port), "%d", node.second);
|
snprintf(port, sizeof(port), "%d", node.second);
|
||||||
udp::resolver::query q(node.first, port);
|
udp::resolver::query q(node.first, port);
|
||||||
m_host_resolver.async_resolve(q,
|
m_host_resolver.async_resolve(q,
|
||||||
bind(&dht_tracker::on_name_lookup, self(), _1, _2));
|
boost::bind(&dht_tracker::on_name_lookup, self(), _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dht_tracker::on_name_lookup(error_code const& e
|
void dht_tracker::on_name_lookup(error_code const& e
|
||||||
|
|
|
@ -49,8 +49,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/kademlia/refresh.hpp"
|
#include "libtorrent/kademlia/refresh.hpp"
|
||||||
#include "libtorrent/kademlia/find_data.hpp"
|
#include "libtorrent/kademlia/find_data.hpp"
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace libtorrent { namespace dht
|
namespace libtorrent { namespace dht
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <boost/bind.hpp>
|
|
||||||
|
|
||||||
#include "libtorrent/kademlia/node_id.hpp"
|
#include "libtorrent/kademlia/node_id.hpp"
|
||||||
#include "libtorrent/hasher.hpp"
|
#include "libtorrent/hasher.hpp"
|
||||||
#include "libtorrent/assert.hpp"
|
#include "libtorrent/assert.hpp"
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace libtorrent { namespace dht
|
namespace libtorrent { namespace dht
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/session_settings.hpp"
|
#include "libtorrent/session_settings.hpp"
|
||||||
#include "libtorrent/time.hpp"
|
#include "libtorrent/time.hpp"
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using boost::uint8_t;
|
using boost::uint8_t;
|
||||||
|
|
||||||
namespace libtorrent { namespace dht
|
namespace libtorrent { namespace dht
|
||||||
|
@ -249,7 +248,7 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
|
|
||||||
// if the node already exists, we don't need it
|
// if the node already exists, we don't need it
|
||||||
bucket_t::iterator j = std::find_if(b.begin(), b.end()
|
bucket_t::iterator j = std::find_if(b.begin(), b.end()
|
||||||
, bind(&node_entry::id, _1) == e.id);
|
, boost::bind(&node_entry::id, _1) == e.id);
|
||||||
|
|
||||||
if (j != b.end())
|
if (j != b.end())
|
||||||
{
|
{
|
||||||
|
@ -262,7 +261,7 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find_if(rb.begin(), rb.end(), bind(&node_entry::id, _1) == e.id)
|
if (std::find_if(rb.begin(), rb.end(), boost::bind(&node_entry::id, _1) == e.id)
|
||||||
!= rb.end()) return ret;
|
!= rb.end()) return ret;
|
||||||
|
|
||||||
// if the node was not present in our list
|
// if the node was not present in our list
|
||||||
|
@ -295,7 +294,7 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
// if the node we're trying to insert is considered pinged,
|
// if the node we're trying to insert is considered pinged,
|
||||||
// we may replace other nodes that aren't pinged
|
// we may replace other nodes that aren't pinged
|
||||||
|
|
||||||
j = std::find_if(b.begin(), b.end(), bind(&node_entry::pinged, _1) == false);
|
j = std::find_if(b.begin(), b.end(), boost::bind(&node_entry::pinged, _1) == false);
|
||||||
|
|
||||||
if (j != b.end() && !j->pinged())
|
if (j != b.end() && !j->pinged())
|
||||||
{
|
{
|
||||||
|
@ -314,8 +313,8 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
// with nodes from that cache.
|
// with nodes from that cache.
|
||||||
|
|
||||||
j = std::max_element(b.begin(), b.end()
|
j = std::max_element(b.begin(), b.end()
|
||||||
, bind(&node_entry::fail_count, _1)
|
, boost::bind(&node_entry::fail_count, _1)
|
||||||
< bind(&node_entry::fail_count, _2));
|
< boost::bind(&node_entry::fail_count, _2));
|
||||||
|
|
||||||
if (j != b.end() && j->fail_count() > 0)
|
if (j != b.end() && j->fail_count() > 0)
|
||||||
{
|
{
|
||||||
|
@ -338,7 +337,7 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
// and then replace it.
|
// and then replace it.
|
||||||
|
|
||||||
j = std::find_if(rb.begin(), rb.end()
|
j = std::find_if(rb.begin(), rb.end()
|
||||||
, bind(&node_entry::id, _1) == e.id);
|
, boost::bind(&node_entry::id, _1) == e.id);
|
||||||
|
|
||||||
// if the node is already in the replacement bucket
|
// if the node is already in the replacement bucket
|
||||||
// just return.
|
// just return.
|
||||||
|
@ -356,7 +355,7 @@ bool routing_table::add_node(node_entry const& e)
|
||||||
// if the replacement bucket is full, remove the oldest entry
|
// if the replacement bucket is full, remove the oldest entry
|
||||||
// but prefer nodes that haven't been pinged, since they are
|
// but prefer nodes that haven't been pinged, since they are
|
||||||
// less reliable than this one, that has been pinged
|
// less reliable than this one, that has been pinged
|
||||||
j = std::find_if(rb.begin(), rb.end(), bind(&node_entry::pinged, _1) == false);
|
j = std::find_if(rb.begin(), rb.end(), boost::bind(&node_entry::pinged, _1) == false);
|
||||||
rb.erase(j != rb.end() ? j : rb.begin());
|
rb.erase(j != rb.end() ? j : rb.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +448,7 @@ void routing_table::node_failed(node_id const& id)
|
||||||
bucket_t& rb = i->replacements;
|
bucket_t& rb = i->replacements;
|
||||||
|
|
||||||
bucket_t::iterator j = std::find_if(b.begin(), b.end()
|
bucket_t::iterator j = std::find_if(b.begin(), b.end()
|
||||||
, bind(&node_entry::id, _1) == id);
|
, boost::bind(&node_entry::id, _1) == id);
|
||||||
|
|
||||||
if (j == b.end()) return;
|
if (j == b.end()) return;
|
||||||
|
|
||||||
|
@ -475,7 +474,7 @@ void routing_table::node_failed(node_id const& id)
|
||||||
|
|
||||||
b.erase(j);
|
b.erase(j);
|
||||||
|
|
||||||
j = std::find_if(rb.begin(), rb.end(), bind(&node_entry::pinged, _1) == true);
|
j = std::find_if(rb.begin(), rb.end(), boost::bind(&node_entry::pinged, _1) == true);
|
||||||
if (j == rb.end()) j = rb.begin();
|
if (j == rb.end()) j = rb.begin();
|
||||||
b.push_back(*j);
|
b.push_back(*j);
|
||||||
rb.erase(j);
|
rb.erase(j);
|
||||||
|
@ -571,7 +570,7 @@ void routing_table::find_node(node_id const& target
|
||||||
{
|
{
|
||||||
copy_if_n(b.begin(), b.end(), std::back_inserter(l)
|
copy_if_n(b.begin(), b.end(), std::back_inserter(l)
|
||||||
, (std::min)(size_t(count), b.size())
|
, (std::min)(size_t(count), b.size())
|
||||||
, bind(&node_entry::confirmed, _1));
|
, boost::bind(&node_entry::confirmed, _1));
|
||||||
}
|
}
|
||||||
TORRENT_ASSERT((int)l.size() <= count);
|
TORRENT_ASSERT((int)l.size() <= count);
|
||||||
|
|
||||||
|
@ -596,7 +595,7 @@ void routing_table::find_node(node_id const& target
|
||||||
{
|
{
|
||||||
std::remove_copy_if(b.begin(), b.begin() + to_copy
|
std::remove_copy_if(b.begin(), b.begin() + to_copy
|
||||||
, std::back_inserter(l)
|
, std::back_inserter(l)
|
||||||
, !bind(&node_entry::confirmed, _1));
|
, !boost::bind(&node_entry::confirmed, _1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +620,7 @@ void routing_table::find_node(node_id const& target
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
copy_if_n(b.begin(), b.end(), std::back_inserter(l)
|
copy_if_n(b.begin(), b.end(), std::back_inserter(l)
|
||||||
, to_copy, bind(&node_entry::confirmed, _1));
|
, to_copy, boost::bind(&node_entry::confirmed, _1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (j != m_buckets.begin() && l.size() < count);
|
while (j != m_buckets.begin() && l.size() < count);
|
||||||
|
|
|
@ -56,7 +56,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace libtorrent { namespace dht
|
namespace libtorrent { namespace dht
|
||||||
{
|
{
|
||||||
|
@ -389,7 +388,7 @@ time_duration rpc_manager::tick()
|
||||||
timeouts.push_back(o);
|
timeouts.push_back(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::for_each(timeouts.begin(), timeouts.end(), bind(&observer::timeout, _1));
|
std::for_each(timeouts.begin(), timeouts.end(), boost::bind(&observer::timeout, _1));
|
||||||
timeouts.clear();
|
timeouts.clear();
|
||||||
|
|
||||||
for (transactions_t::iterator i = m_transactions.begin();
|
for (transactions_t::iterator i = m_transactions.begin();
|
||||||
|
@ -414,7 +413,7 @@ time_duration rpc_manager::tick()
|
||||||
timeouts.push_back(o);
|
timeouts.push_back(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::for_each(timeouts.begin(), timeouts.end(), bind(&observer::short_timeout, _1));
|
std::for_each(timeouts.begin(), timeouts.end(), boost::bind(&observer::short_timeout, _1));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace libtorrent { namespace dht
|
namespace libtorrent { namespace dht
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||||
|
@ -61,10 +59,10 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
|
||||||
m_results.begin()
|
m_results.begin()
|
||||||
, m_results.end()
|
, m_results.end()
|
||||||
, entry
|
, entry
|
||||||
, bind(
|
, boost::bind(
|
||||||
compare_ref
|
compare_ref
|
||||||
, bind(&result::id, _1)
|
, boost::bind(&result::id, _1)
|
||||||
, bind(&result::id, _2)
|
, boost::bind(&result::id, _2)
|
||||||
, m_target
|
, m_target
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -72,7 +70,7 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
|
||||||
if (i == m_results.end() || i->id != id)
|
if (i == m_results.end() || i->id != id)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(std::find_if(m_results.begin(), m_results.end()
|
TORRENT_ASSERT(std::find_if(m_results.begin(), m_results.end()
|
||||||
, bind(&result::id, _1) == id) == m_results.end());
|
, boost::bind(&result::id, _1) == id) == m_results.end());
|
||||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||||
TORRENT_LOG(traversal) << "[" << this << "] adding result: " << id << " " << addr;
|
TORRENT_LOG(traversal) << "[" << this << "] adding result: " << id << " " << addr;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,7 +52,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
|
@ -68,7 +67,7 @@ lsd::lsd(io_service& ios, address const& listen_interface
|
||||||
: m_callback(cb)
|
: m_callback(cb)
|
||||||
, m_retry_count(1)
|
, m_retry_count(1)
|
||||||
, m_socket(ios, udp::endpoint(address_v4::from_string("239.192.152.143", ec), 6771)
|
, m_socket(ios, udp::endpoint(address_v4::from_string("239.192.152.143", ec), 6771)
|
||||||
, bind(&lsd::on_announce, self(), _1, _2, _3))
|
, boost::bind(&lsd::on_announce, self(), _1, _2, _3))
|
||||||
, m_broadcast_timer(ios)
|
, m_broadcast_timer(ios)
|
||||||
, m_disabled(false)
|
, m_disabled(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,7 +48,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <boost/asio/ip/host_name.hpp>
|
#include <boost/asio/ip/host_name.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
natpmp::natpmp(io_service& ios, address const& listen_interface
|
natpmp::natpmp(io_service& ios, address const& listen_interface
|
||||||
|
@ -107,7 +106,7 @@ void natpmp::rebind(address const& listen_interface)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_socket.async_receive_from(asio::buffer(&m_response_buffer, 16)
|
m_socket.async_receive_from(asio::buffer(&m_response_buffer, 16)
|
||||||
, m_remote, bind(&natpmp::on_reply, self(), _1, _2));
|
, m_remote, boost::bind(&natpmp::on_reply, self(), _1, _2));
|
||||||
|
|
||||||
for (std::vector<mapping_t>::iterator i = m_mappings.begin()
|
for (std::vector<mapping_t>::iterator i = m_mappings.begin()
|
||||||
, end(m_mappings.end()); i != end; ++i)
|
, end(m_mappings.end()); i != end; ++i)
|
||||||
|
@ -328,7 +327,7 @@ void natpmp::send_map_request(int i, mutex::scoped_lock& l)
|
||||||
// linear back-off instead of exponential
|
// linear back-off instead of exponential
|
||||||
++m_retry_count;
|
++m_retry_count;
|
||||||
m_send_timer.expires_from_now(milliseconds(250 * m_retry_count), ec);
|
m_send_timer.expires_from_now(milliseconds(250 * m_retry_count), ec);
|
||||||
m_send_timer.async_wait(bind(&natpmp::resend_request, self(), i, _1));
|
m_send_timer.async_wait(boost::bind(&natpmp::resend_request, self(), i, _1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +366,7 @@ void natpmp::on_reply(error_code const& e
|
||||||
}
|
}
|
||||||
|
|
||||||
m_socket.async_receive_from(asio::buffer(&m_response_buffer, 16)
|
m_socket.async_receive_from(asio::buffer(&m_response_buffer, 16)
|
||||||
, m_remote, bind(&natpmp::on_reply, self(), _1, _2));
|
, m_remote, boost::bind(&natpmp::on_reply, self(), _1, _2));
|
||||||
|
|
||||||
// simulate packet loss
|
// simulate packet loss
|
||||||
/*
|
/*
|
||||||
|
@ -533,7 +532,7 @@ void natpmp::update_expiration_timer()
|
||||||
error_code ec;
|
error_code ec;
|
||||||
if (m_next_refresh >= 0) m_refresh_timer.cancel(ec);
|
if (m_next_refresh >= 0) m_refresh_timer.cancel(ec);
|
||||||
m_refresh_timer.expires_from_now(min_expire - now, ec);
|
m_refresh_timer.expires_from_now(min_expire - now, ec);
|
||||||
m_refresh_timer.async_wait(bind(&natpmp::mapping_expired, self(), _1, min_index));
|
m_refresh_timer.async_wait(boost::bind(&natpmp::mapping_expired, self(), _1, min_index));
|
||||||
m_next_refresh = min_index;
|
m_next_refresh = min_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
//#define TORRENT_CORRUPT_DATA
|
//#define TORRENT_CORRUPT_DATA
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
||||||
|
@ -1230,7 +1229,7 @@ namespace libtorrent
|
||||||
|
|
||||||
std::vector<pending_block>::iterator i = std::find_if(
|
std::vector<pending_block>::iterator i = std::find_if(
|
||||||
m_download_queue.begin(), m_download_queue.end()
|
m_download_queue.begin(), m_download_queue.end()
|
||||||
, bind(match_request, boost::cref(r), bind(&pending_block::block, _1)
|
, boost::bind(match_request, boost::cref(r), boost::bind(&pending_block::block, _1)
|
||||||
, t->block_size()));
|
, t->block_size()));
|
||||||
|
|
||||||
#ifdef TORRENT_VERBOSE_LOGGING
|
#ifdef TORRENT_VERBOSE_LOGGING
|
||||||
|
@ -2326,7 +2325,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.async_write(p, data, bind(&peer_connection::on_disk_write_complete
|
fs.async_write(p, data, boost::bind(&peer_connection::on_disk_write_complete
|
||||||
, self(), _1, _2, p, t));
|
, self(), _1, _2, p, t));
|
||||||
m_outstanding_writing_bytes += p.length;
|
m_outstanding_writing_bytes += p.length;
|
||||||
TORRENT_ASSERT(m_channel_state[download_channel] == peer_info::bw_idle);
|
TORRENT_ASSERT(m_channel_state[download_channel] == peer_info::bw_idle);
|
||||||
|
@ -2376,7 +2375,7 @@ namespace libtorrent
|
||||||
#ifdef TORRENT_DEBUG
|
#ifdef TORRENT_DEBUG
|
||||||
check_postcondition post_checker2_(t, false);
|
check_postcondition post_checker2_(t, false);
|
||||||
#endif
|
#endif
|
||||||
t->async_verify_piece(p.piece, bind(&torrent::piece_finished, t
|
t->async_verify_piece(p.piece, boost::bind(&torrent::piece_finished, t
|
||||||
, p.piece, _1));
|
, p.piece, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4017,14 +4016,14 @@ namespace libtorrent
|
||||||
|
|
||||||
if (!t->seed_mode() || t->verified_piece(r.piece))
|
if (!t->seed_mode() || t->verified_piece(r.piece))
|
||||||
{
|
{
|
||||||
t->filesystem().async_read(r, bind(&peer_connection::on_disk_read_complete
|
t->filesystem().async_read(r, boost::bind(&peer_connection::on_disk_read_complete
|
||||||
, self(), _1, _2, r), cache.first, cache.second);
|
, self(), _1, _2, r), cache.first, cache.second);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// this means we're in seed mode and we haven't yet
|
// this means we're in seed mode and we haven't yet
|
||||||
// verified this piece (r.piece)
|
// verified this piece (r.piece)
|
||||||
t->filesystem().async_read_and_hash(r, bind(&peer_connection::on_disk_read_complete
|
t->filesystem().async_read_and_hash(r, boost::bind(&peer_connection::on_disk_read_complete
|
||||||
, self(), _1, _2, r), cache.second);
|
, self(), _1, _2, r), cache.second);
|
||||||
t->verified(r.piece);
|
t->verified(r.piece);
|
||||||
}
|
}
|
||||||
|
@ -4286,7 +4285,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
std::list<asio::const_buffer> const& vec = m_send_buffer.build_iovec(amount_to_send);
|
std::list<asio::const_buffer> const& vec = m_send_buffer.build_iovec(amount_to_send);
|
||||||
m_socket->async_write_some(
|
m_socket->async_write_some(
|
||||||
vec, make_write_handler(bind(
|
vec, make_write_handler(boost::bind(
|
||||||
&peer_connection::on_send_data, self(), _1, _2)));
|
&peer_connection::on_send_data, self(), _1, _2)));
|
||||||
|
|
||||||
m_channel_state[upload_channel] = peer_info::bw_network;
|
m_channel_state[upload_channel] = peer_info::bw_network;
|
||||||
|
@ -4375,7 +4374,7 @@ namespace libtorrent
|
||||||
m_socket->async_read_some(asio::buffer(&m_recv_buffer[m_recv_pos]
|
m_socket->async_read_some(asio::buffer(&m_recv_buffer[m_recv_pos]
|
||||||
, max_receive)
|
, max_receive)
|
||||||
, make_read_handler(
|
, make_read_handler(
|
||||||
bind(&peer_connection::on_receive_data, self(), _1, _2)
|
boost::bind(&peer_connection::on_receive_data, self(), _1, _2)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else if (m_recv_pos >= regular_buffer_size)
|
else if (m_recv_pos >= regular_buffer_size)
|
||||||
|
@ -4386,7 +4385,7 @@ namespace libtorrent
|
||||||
m_socket->async_read_some(asio::buffer(m_disk_recv_buffer.get() + m_recv_pos - regular_buffer_size
|
m_socket->async_read_some(asio::buffer(m_disk_recv_buffer.get() + m_recv_pos - regular_buffer_size
|
||||||
, max_receive)
|
, max_receive)
|
||||||
, make_read_handler(
|
, make_read_handler(
|
||||||
bind(&peer_connection::on_receive_data, self(), _1, _2)
|
boost::bind(&peer_connection::on_receive_data, self(), _1, _2)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4404,7 +4403,7 @@ namespace libtorrent
|
||||||
, max_receive - regular_buffer_size + m_recv_pos);
|
, max_receive - regular_buffer_size + m_recv_pos);
|
||||||
m_socket->async_read_some(
|
m_socket->async_read_some(
|
||||||
vec, make_read_handler(
|
vec, make_read_handler(
|
||||||
bind(&peer_connection::on_receive_data, self(), _1, _2)));
|
boost::bind(&peer_connection::on_receive_data, self(), _1, _2)));
|
||||||
}
|
}
|
||||||
m_channel_state[download_channel] = peer_info::bw_network;
|
m_channel_state[download_channel] = peer_info::bw_network;
|
||||||
}
|
}
|
||||||
|
@ -4487,7 +4486,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(buffer.second >= size);
|
TORRENT_ASSERT(buffer.second >= size);
|
||||||
std::memcpy(buffer.first, buf, size);
|
std::memcpy(buffer.first, buf, size);
|
||||||
m_send_buffer.append_buffer(buffer.first, buffer.second, size
|
m_send_buffer.append_buffer(buffer.first, buffer.second, size
|
||||||
, bind(&session_impl::free_buffer, boost::ref(m_ses), _1, buffer.second));
|
, boost::bind(&session_impl::free_buffer, boost::ref(m_ses), _1, buffer.second));
|
||||||
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
m_ses.m_buffer_usage_logger << log_time() << " send_buffer_alloc: " << size << std::endl;
|
m_ses.m_buffer_usage_logger << log_time() << " send_buffer_alloc: " << size << std::endl;
|
||||||
m_ses.log_buffer_usage();
|
m_ses.log_buffer_usage();
|
||||||
|
@ -4511,7 +4510,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
TORRENT_ASSERT(buffer.second >= size);
|
TORRENT_ASSERT(buffer.second >= size);
|
||||||
m_send_buffer.append_buffer(buffer.first, buffer.second, size
|
m_send_buffer.append_buffer(buffer.first, buffer.second, size
|
||||||
, bind(&session_impl::free_buffer, boost::ref(m_ses), _1, buffer.second));
|
, boost::bind(&session_impl::free_buffer, boost::ref(m_ses), _1, buffer.second));
|
||||||
buffer::interval ret(buffer.first, buffer.first + size);
|
buffer::interval ret(buffer.first, buffer.first + size);
|
||||||
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
|
||||||
m_ses.m_buffer_usage_logger << log_time() << " allocate_buffer_alloc: " << size << std::endl;
|
m_ses.m_buffer_usage_logger << log_time() << " allocate_buffer_alloc: " << size << std::endl;
|
||||||
|
@ -4803,7 +4802,7 @@ namespace libtorrent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_socket->async_connect(m_remote
|
m_socket->async_connect(m_remote
|
||||||
, bind(&peer_connection::on_connection_complete, self(), _1));
|
, boost::bind(&peer_connection::on_connection_complete, self(), _1));
|
||||||
m_connect = time_now();
|
m_connect = time_now();
|
||||||
m_statistics.sent_syn(m_remote.address().is_v6());
|
m_statistics.sent_syn(m_remote.address().is_v6());
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
std::vector<downloading_piece>::const_iterator piece = std::find_if(
|
std::vector<downloading_piece>::const_iterator piece = std::find_if(
|
||||||
m_downloads.begin(), m_downloads.end()
|
m_downloads.begin(), m_downloads.end()
|
||||||
, bind(&downloading_piece::index, _1) == index);
|
, boost::bind(&downloading_piece::index, _1) == index);
|
||||||
TORRENT_ASSERT(piece != m_downloads.end());
|
TORRENT_ASSERT(piece != m_downloads.end());
|
||||||
st = *piece;
|
st = *piece;
|
||||||
st.info = 0;
|
st.info = 0;
|
||||||
|
@ -186,7 +186,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
std::vector<downloading_piece>::iterator other = std::find_if(
|
std::vector<downloading_piece>::iterator other = std::find_if(
|
||||||
m_downloads.begin(), m_downloads.end()
|
m_downloads.begin(), m_downloads.end()
|
||||||
, bind(&downloading_piece::info, _1)
|
, boost::bind(&downloading_piece::info, _1)
|
||||||
== &m_block_info[(m_downloads.size() - 1) * m_blocks_per_piece]);
|
== &m_block_info[(m_downloads.size() - 1) * m_blocks_per_piece]);
|
||||||
TORRENT_ASSERT(other != m_downloads.end());
|
TORRENT_ASSERT(other != m_downloads.end());
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/bt_peer_connection.hpp"
|
#include "libtorrent/bt_peer_connection.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
|
@ -75,7 +75,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
using boost::weak_ptr;
|
using boost::weak_ptr;
|
||||||
using boost::bind;
|
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
||||||
#ifdef TORRENT_MEMDEBUG
|
#ifdef TORRENT_MEMDEBUG
|
||||||
|
@ -911,9 +910,9 @@ namespace libtorrent
|
||||||
l.unlock();
|
l.unlock();
|
||||||
natpmp* n = new (std::nothrow) natpmp(m_impl->m_io_service
|
natpmp* n = new (std::nothrow) natpmp(m_impl->m_io_service
|
||||||
, m_impl->m_listen_interface.address()
|
, m_impl->m_listen_interface.address()
|
||||||
, bind(&session_impl::on_port_mapping
|
, boost::bind(&session_impl::on_port_mapping
|
||||||
, m_impl.get(), _1, _2, _3, 0)
|
, m_impl.get(), _1, _2, _3, 0)
|
||||||
, bind(&session_impl::on_port_map_log
|
, boost::bind(&session_impl::on_port_map_log
|
||||||
, m_impl.get(), _1, 0));
|
, m_impl.get(), _1, 0));
|
||||||
l.lock();
|
l.lock();
|
||||||
|
|
||||||
|
@ -936,9 +935,9 @@ namespace libtorrent
|
||||||
, m_impl->m_half_open
|
, m_impl->m_half_open
|
||||||
, m_impl->m_listen_interface.address()
|
, m_impl->m_listen_interface.address()
|
||||||
, m_impl->m_settings.user_agent
|
, m_impl->m_settings.user_agent
|
||||||
, bind(&session_impl::on_port_mapping
|
, boost::bind(&session_impl::on_port_mapping
|
||||||
, m_impl.get(), _1, _2, _3, 1)
|
, m_impl.get(), _1, _2, _3, 1)
|
||||||
, bind(&session_impl::on_port_map_log
|
, boost::bind(&session_impl::on_port_map_log
|
||||||
, m_impl.get(), _1, 1)
|
, m_impl.get(), _1, 1)
|
||||||
, m_impl->m_settings.upnp_ignore_nonrouters);
|
, m_impl->m_settings.upnp_ignore_nonrouters);
|
||||||
l.lock();
|
l.lock();
|
||||||
|
|
|
@ -149,7 +149,6 @@ namespace
|
||||||
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
using boost::weak_ptr;
|
using boost::weak_ptr;
|
||||||
using boost::bind;
|
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
||||||
#ifdef BOOST_NO_EXCEPTIONS
|
#ifdef BOOST_NO_EXCEPTIONS
|
||||||
|
@ -508,7 +507,7 @@ namespace aux {
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
, m_dht_same_port(true)
|
, m_dht_same_port(true)
|
||||||
, m_external_udp_port(0)
|
, m_external_udp_port(0)
|
||||||
, m_dht_socket(m_io_service, bind(&session_impl::on_receive_udp, this, _1, _2, _3, _4)
|
, m_dht_socket(m_io_service, boost::bind(&session_impl::on_receive_udp, this, _1, _2, _3, _4)
|
||||||
, m_half_open)
|
, m_half_open)
|
||||||
, m_dht_announce_timer(m_io_service)
|
, m_dht_announce_timer(m_io_service)
|
||||||
#endif
|
#endif
|
||||||
|
@ -724,20 +723,20 @@ namespace aux {
|
||||||
url_random((char*)&m_peer_id[print.length()], (char*)&m_peer_id[0] + 20);
|
url_random((char*)&m_peer_id[print.length()], (char*)&m_peer_id[0] + 20);
|
||||||
|
|
||||||
m_timer.expires_from_now(milliseconds(100), ec);
|
m_timer.expires_from_now(milliseconds(100), ec);
|
||||||
m_timer.async_wait(bind(&session_impl::on_tick, this, _1));
|
m_timer.async_wait(boost::bind(&session_impl::on_tick, this, _1));
|
||||||
|
|
||||||
int delay = (std::max)(m_settings.local_service_announce_interval
|
int delay = (std::max)(m_settings.local_service_announce_interval
|
||||||
/ (std::max)(int(m_torrents.size()), 1), 1);
|
/ (std::max)(int(m_torrents.size()), 1), 1);
|
||||||
m_lsd_announce_timer.expires_from_now(seconds(delay), ec);
|
m_lsd_announce_timer.expires_from_now(seconds(delay), ec);
|
||||||
m_lsd_announce_timer.async_wait(
|
m_lsd_announce_timer.async_wait(
|
||||||
bind(&session_impl::on_lsd_announce, this, _1));
|
boost::bind(&session_impl::on_lsd_announce, this, _1));
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
delay = (std::max)(m_settings.dht_announce_interval
|
delay = (std::max)(m_settings.dht_announce_interval
|
||||||
/ (std::max)(int(m_torrents.size()), 1), 1);
|
/ (std::max)(int(m_torrents.size()), 1), 1);
|
||||||
m_dht_announce_timer.expires_from_now(seconds(delay), ec);
|
m_dht_announce_timer.expires_from_now(seconds(delay), ec);
|
||||||
m_dht_announce_timer.async_wait(
|
m_dht_announce_timer.async_wait(
|
||||||
bind(&session_impl::on_dht_announce, this, _1));
|
boost::bind(&session_impl::on_dht_announce, this, _1));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_thread.reset(new thread(boost::bind(&session_impl::main_thread, this)));
|
m_thread.reset(new thread(boost::bind(&session_impl::main_thread, this)));
|
||||||
|
@ -1210,7 +1209,7 @@ namespace aux {
|
||||||
/ (std::max)(int(m_torrents.size()), 1), 1);
|
/ (std::max)(int(m_torrents.size()), 1), 1);
|
||||||
m_dht_announce_timer.expires_from_now(seconds(delay), ec);
|
m_dht_announce_timer.expires_from_now(seconds(delay), ec);
|
||||||
m_dht_announce_timer.async_wait(
|
m_dht_announce_timer.async_wait(
|
||||||
bind(&session_impl::on_dht_announce, this, _1));
|
boost::bind(&session_impl::on_dht_announce, this, _1));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1221,7 +1220,7 @@ namespace aux {
|
||||||
/ (std::max)(int(m_torrents.size()), 1), 1);
|
/ (std::max)(int(m_torrents.size()), 1), 1);
|
||||||
m_lsd_announce_timer.expires_from_now(seconds(delay), ec);
|
m_lsd_announce_timer.expires_from_now(seconds(delay), ec);
|
||||||
m_lsd_announce_timer.async_wait(
|
m_lsd_announce_timer.async_wait(
|
||||||
bind(&session_impl::on_lsd_announce, this, _1));
|
boost::bind(&session_impl::on_lsd_announce, this, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if queuing settings were changed, recalculate
|
// if queuing settings were changed, recalculate
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace
|
||||||
{
|
{
|
||||||
if (*i != 0)
|
if (*i != 0)
|
||||||
{
|
{
|
||||||
m_torrent.filesystem().async_read(r, bind(&smart_ban_plugin::on_read_failed_block
|
m_torrent.filesystem().async_read(r, boost::bind(&smart_ban_plugin::on_read_failed_block
|
||||||
, shared_from_this(), pb, ((policy::peer*)*i)->address(), _1, _2));
|
, shared_from_this(), pb, ((policy::peer*)*i)->address(), _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// for convert_to_wstring and convert_to_native
|
// for convert_to_wstring and convert_to_native
|
||||||
#include "libtorrent/escape_string.hpp"
|
#include "libtorrent/escape_string.hpp"
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
#if defined TORRENT_DEBUG && defined TORRENT_STORAGE_DEBUG && TORRENT_USE_IOSTREAM
|
#if defined TORRENT_DEBUG && defined TORRENT_STORAGE_DEBUG && TORRENT_USE_IOSTREAM
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,6 @@ using namespace libtorrent;
|
||||||
using boost::tuples::tuple;
|
using boost::tuples::tuple;
|
||||||
using boost::tuples::get;
|
using boost::tuples::get;
|
||||||
using boost::tuples::make_tuple;
|
using boost::tuples::make_tuple;
|
||||||
using boost::bind;
|
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -523,7 +522,7 @@ namespace libtorrent
|
||||||
for (int i = 0; i < blocks_in_piece; ++i, r.start += block_size())
|
for (int i = 0; i < blocks_in_piece; ++i, r.start += block_size())
|
||||||
{
|
{
|
||||||
r.length = (std::min)(piece_size - r.start, block_size());
|
r.length = (std::min)(piece_size - r.start, block_size());
|
||||||
filesystem().async_read(r, bind(&torrent::on_disk_read_complete
|
filesystem().async_read(r, boost::bind(&torrent::on_disk_read_complete
|
||||||
, shared_from_this(), _1, _2, r, rp));
|
, shared_from_this(), _1, _2, r, rp));
|
||||||
++rp->blocks_left;
|
++rp->blocks_left;
|
||||||
}
|
}
|
||||||
|
@ -699,13 +698,13 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
disk_buffer_holder holder(m_ses, buffer);
|
disk_buffer_holder holder(m_ses, buffer);
|
||||||
std::memcpy(buffer, data + p.start, p.length);
|
std::memcpy(buffer, data + p.start, p.length);
|
||||||
filesystem().async_write(p, holder, bind(&torrent::on_disk_write_complete
|
filesystem().async_write(p, holder, boost::bind(&torrent::on_disk_write_complete
|
||||||
, shared_from_this(), _1, _2, p));
|
, shared_from_this(), _1, _2, p));
|
||||||
piece_block block(piece, i);
|
piece_block block(piece, i);
|
||||||
picker().mark_as_downloading(block, 0, piece_picker::fast);
|
picker().mark_as_downloading(block, 0, piece_picker::fast);
|
||||||
picker().mark_as_writing(block, 0);
|
picker().mark_as_writing(block, 0);
|
||||||
}
|
}
|
||||||
async_verify_piece(piece, bind(&torrent::piece_finished
|
async_verify_piece(piece, boost::bind(&torrent::piece_finished
|
||||||
, shared_from_this(), piece, _1));
|
, shared_from_this(), piece, _1));
|
||||||
picker().dec_refcount(piece);
|
picker().dec_refcount(piece);
|
||||||
}
|
}
|
||||||
|
@ -930,7 +929,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
m_storage->async_check_fastresume(&m_resume_entry
|
m_storage->async_check_fastresume(&m_resume_entry
|
||||||
, bind(&torrent::on_resume_data_checked
|
, boost::bind(&torrent::on_resume_data_checked
|
||||||
, shared_from_this(), _1, _2));
|
, shared_from_this(), _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1110,7 +1109,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
m_picker->mark_as_finished(piece_block(piece, bit), 0);
|
m_picker->mark_as_finished(piece_block(piece, bit), 0);
|
||||||
if (m_picker->is_piece_finished(piece))
|
if (m_picker->is_piece_finished(piece))
|
||||||
async_verify_piece(piece, bind(&torrent::piece_finished
|
async_verify_piece(piece, boost::bind(&torrent::piece_finished
|
||||||
, shared_from_this(), piece, _1));
|
, shared_from_this(), piece, _1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1184,7 +1183,7 @@ namespace libtorrent
|
||||||
std::vector<char>().swap(m_resume_data);
|
std::vector<char>().swap(m_resume_data);
|
||||||
lazy_entry().swap(m_resume_entry);
|
lazy_entry().swap(m_resume_entry);
|
||||||
m_storage->async_check_fastresume(&m_resume_entry
|
m_storage->async_check_fastresume(&m_resume_entry
|
||||||
, bind(&torrent::on_force_recheck
|
, boost::bind(&torrent::on_force_recheck
|
||||||
, shared_from_this(), _1, _2));
|
, shared_from_this(), _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1215,7 +1214,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(should_check_files());
|
TORRENT_ASSERT(should_check_files());
|
||||||
set_state(torrent_status::checking_files);
|
set_state(torrent_status::checking_files);
|
||||||
|
|
||||||
m_storage->async_check_files(bind(
|
m_storage->async_check_files(boost::bind(
|
||||||
&torrent::on_piece_checked
|
&torrent::on_piece_checked
|
||||||
, shared_from_this(), _1, _2));
|
, shared_from_this(), _1, _2));
|
||||||
}
|
}
|
||||||
|
@ -1326,7 +1325,7 @@ namespace libtorrent
|
||||||
boost::weak_ptr<torrent> self(shared_from_this());
|
boost::weak_ptr<torrent> self(shared_from_this());
|
||||||
m_ses.m_dht->announce(m_torrent_file->info_hash()
|
m_ses.m_dht->announce(m_torrent_file->info_hash()
|
||||||
, m_ses.listen_port()
|
, m_ses.listen_port()
|
||||||
, bind(&torrent::on_dht_announce_response_disp, self, _1));
|
, boost::bind(&torrent::on_dht_announce_response_disp, self, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::on_dht_announce_response_disp(boost::weak_ptr<libtorrent::torrent> t
|
void torrent::on_dht_announce_response_disp(boost::weak_ptr<libtorrent::torrent> t
|
||||||
|
@ -1350,7 +1349,7 @@ namespace libtorrent
|
||||||
if (torrent_file().priv() || (torrent_file().is_i2p()
|
if (torrent_file().priv() || (torrent_file().is_i2p()
|
||||||
&& !settings().allow_i2p_mixed)) return;
|
&& !settings().allow_i2p_mixed)) return;
|
||||||
|
|
||||||
std::for_each(peers.begin(), peers.end(), bind(
|
std::for_each(peers.begin(), peers.end(), boost::bind(
|
||||||
&policy::add_peer, boost::ref(m_policy), _1, peer_id(0)
|
&policy::add_peer, boost::ref(m_policy), _1, peer_id(0)
|
||||||
, peer_info::dht, 0));
|
, peer_info::dht, 0));
|
||||||
}
|
}
|
||||||
|
@ -1651,7 +1650,7 @@ namespace libtorrent
|
||||||
// to do the name lookup
|
// to do the name lookup
|
||||||
/*
|
/*
|
||||||
m_ses.m_i2p_conn.async_name_lookup(i->ip.c_str()
|
m_ses.m_i2p_conn.async_name_lookup(i->ip.c_str()
|
||||||
, bind(&torrent::on_i2p_resolve
|
, boost::bind(&torrent::on_i2p_resolve
|
||||||
, shared_from_this(), _1, _2));
|
, shared_from_this(), _1, _2));
|
||||||
*/
|
*/
|
||||||
// it seems like you're not supposed to do a name lookup
|
// it seems like you're not supposed to do a name lookup
|
||||||
|
@ -1665,7 +1664,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
tcp::resolver::query q(i->ip, to_string(i->port).elems);
|
tcp::resolver::query q(i->ip, to_string(i->port).elems);
|
||||||
m_ses.m_host_resolver.async_resolve(q,
|
m_ses.m_host_resolver.async_resolve(q,
|
||||||
bind(&torrent::on_peer_name_lookup, shared_from_this(), _1, _2, i->pid));
|
boost::bind(&torrent::on_peer_name_lookup, shared_from_this(), _1, _2, i->pid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2921,7 +2920,7 @@ namespace libtorrent
|
||||||
// come here several times with the same start_piece, end_piece
|
// come here several times with the same start_piece, end_piece
|
||||||
std::for_each(pieces.begin() + start_piece
|
std::for_each(pieces.begin() + start_piece
|
||||||
, pieces.begin() + last_piece + 1
|
, pieces.begin() + last_piece + 1
|
||||||
, bind(&set_if_greater, _1, m_file_priority[i]));
|
, boost::bind(&set_if_greater, _1, m_file_priority[i]));
|
||||||
}
|
}
|
||||||
prioritize_pieces(pieces);
|
prioritize_pieces(pieces);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,6 @@ namespace std
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
||||||
#ifdef BOOST_NO_EXCEPTIONS
|
#ifdef BOOST_NO_EXCEPTIONS
|
||||||
|
|
|
@ -1115,9 +1115,8 @@ namespace libtorrent
|
||||||
e.source = announce_entry::source_client;
|
e.source = announce_entry::source_client;
|
||||||
m_urls.push_back(e);
|
m_urls.push_back(e);
|
||||||
|
|
||||||
using boost::bind;
|
std::sort(m_urls.begin(), m_urls.end(), boost::bind(&announce_entry::tier, _1)
|
||||||
std::sort(m_urls.begin(), m_urls.end(), bind(&announce_entry::tier, _1)
|
< boost::bind(&announce_entry::tier, _2));
|
||||||
< bind(&announce_entry::tier, _2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined TORRENT_NO_DEPRECATE && TORRENT_USE_IOSTREAM
|
#if !defined TORRENT_NO_DEPRECATE && TORRENT_USE_IOSTREAM
|
||||||
|
|
|
@ -44,7 +44,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using boost::tuples::make_tuple;
|
using boost::tuples::make_tuple;
|
||||||
using boost::tuples::tuple;
|
using boost::tuples::tuple;
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -79,7 +78,7 @@ namespace libtorrent
|
||||||
m_read_timeout, (std::min)(m_completion_timeout, m_read_timeout));
|
m_read_timeout, (std::min)(m_completion_timeout, m_read_timeout));
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_timeout.expires_at(m_read_time + seconds(timeout), ec);
|
m_timeout.expires_at(m_read_time + seconds(timeout), ec);
|
||||||
m_timeout.async_wait(bind(
|
m_timeout.async_wait(boost::bind(
|
||||||
&timeout_handler::timeout_callback, self(), _1));
|
&timeout_handler::timeout_callback, self(), _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +120,7 @@ namespace libtorrent
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_timeout.expires_at(m_read_time + seconds(timeout), ec);
|
m_timeout.expires_at(m_read_time + seconds(timeout), ec);
|
||||||
m_timeout.async_wait(
|
m_timeout.async_wait(
|
||||||
bind(&timeout_handler::timeout_callback, self(), _1));
|
boost::bind(&timeout_handler::timeout_callback, self(), _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
tracker_connection::tracker_connection(
|
tracker_connection::tracker_connection(
|
||||||
|
|
|
@ -52,8 +52,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/aux_/session_impl.hpp"
|
#include "libtorrent/aux_/session_impl.hpp"
|
||||||
#include "libtorrent/escape_string.hpp"
|
#include "libtorrent/escape_string.hpp"
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
33
src/upnp.cpp
33
src/upnp.cpp
|
@ -53,7 +53,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
static error_code ec;
|
static error_code ec;
|
||||||
|
@ -68,7 +67,7 @@ upnp::upnp(io_service& ios, connection_queue& cc
|
||||||
, m_retry_count(0)
|
, m_retry_count(0)
|
||||||
, m_io_service(ios)
|
, m_io_service(ios)
|
||||||
, m_socket(ios, udp::endpoint(address_v4::from_string("239.255.255.250", ec), 1900)
|
, m_socket(ios, udp::endpoint(address_v4::from_string("239.255.255.250", ec), 1900)
|
||||||
, bind(&upnp::on_reply, self(), _1, _2, _3))
|
, boost::bind(&upnp::on_reply, self(), _1, _2, _3))
|
||||||
, m_broadcast_timer(ios)
|
, m_broadcast_timer(ios)
|
||||||
, m_refresh_timer(ios)
|
, m_refresh_timer(ios)
|
||||||
, m_disabled(false)
|
, m_disabled(false)
|
||||||
|
@ -147,7 +146,7 @@ void upnp::discover_device_impl(mutex::scoped_lock& l)
|
||||||
|
|
||||||
++m_retry_count;
|
++m_retry_count;
|
||||||
m_broadcast_timer.expires_from_now(seconds(2 * m_retry_count), ec);
|
m_broadcast_timer.expires_from_now(seconds(2 * m_retry_count), ec);
|
||||||
m_broadcast_timer.async_wait(bind(&upnp::resend_request
|
m_broadcast_timer.async_wait(boost::bind(&upnp::resend_request
|
||||||
, self(), _1));
|
, self(), _1));
|
||||||
|
|
||||||
log("broadcasting search for rootdevice", l);
|
log("broadcasting search for rootdevice", l);
|
||||||
|
@ -284,7 +283,7 @@ void upnp::resend_request(error_code const& e)
|
||||||
log(msg, l);
|
log(msg, l);
|
||||||
if (d.upnp_connection) d.upnp_connection->close();
|
if (d.upnp_connection) d.upnp_connection->close();
|
||||||
d.upnp_connection.reset(new http_connection(m_io_service
|
d.upnp_connection.reset(new http_connection(m_io_service
|
||||||
, m_cc, bind(&upnp::on_upnp_xml, self(), _1, _2
|
, m_cc, boost::bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||||
, boost::ref(d), _5)));
|
, boost::ref(d), _5)));
|
||||||
d.upnp_connection->get(d.url, seconds(30), 1);
|
d.upnp_connection->get(d.url, seconds(30), 1);
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
@ -371,7 +370,7 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
||||||
{
|
{
|
||||||
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
|
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
|
||||||
if (std::find_if(routes.begin(), routes.end()
|
if (std::find_if(routes.begin(), routes.end()
|
||||||
, bind(&ip_route::gateway, _1) == from.address()) == routes.end())
|
, boost::bind(&ip_route::gateway, _1) == from.address()) == routes.end())
|
||||||
{
|
{
|
||||||
// this upnp device is filtered because it's not in the
|
// this upnp device is filtered because it's not in the
|
||||||
// list of configured routers
|
// list of configured routers
|
||||||
|
@ -546,7 +545,7 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
||||||
|
|
||||||
if (d.upnp_connection) d.upnp_connection->close();
|
if (d.upnp_connection) d.upnp_connection->close();
|
||||||
d.upnp_connection.reset(new http_connection(m_io_service
|
d.upnp_connection.reset(new http_connection(m_io_service
|
||||||
, m_cc, bind(&upnp::on_upnp_xml, self(), _1, _2
|
, m_cc, boost::bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||||
, boost::ref(d), _5)));
|
, boost::ref(d), _5)));
|
||||||
d.upnp_connection->get(d.url, seconds(30), 1);
|
d.upnp_connection->get(d.url, seconds(30), 1);
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
|
@ -693,9 +692,9 @@ void upnp::update_map(rootdevice& d, int i, mutex::scoped_lock& l)
|
||||||
|
|
||||||
if (d.upnp_connection) d.upnp_connection->close();
|
if (d.upnp_connection) d.upnp_connection->close();
|
||||||
d.upnp_connection.reset(new http_connection(m_io_service
|
d.upnp_connection.reset(new http_connection(m_io_service
|
||||||
, m_cc, bind(&upnp::on_upnp_map_response, self(), _1, _2
|
, m_cc, boost::bind(&upnp::on_upnp_map_response, self(), _1, _2
|
||||||
, boost::ref(d), i, _5), true
|
, boost::ref(d), i, _5), true
|
||||||
, bind(&upnp::create_port_mapping, self(), _1, boost::ref(d), i)));
|
, boost::bind(&upnp::create_port_mapping, self(), _1, boost::ref(d), i)));
|
||||||
|
|
||||||
d.upnp_connection->start(d.hostname, to_string(d.port).elems
|
d.upnp_connection->start(d.hostname, to_string(d.port).elems
|
||||||
, seconds(10), 1);
|
, seconds(10), 1);
|
||||||
|
@ -704,9 +703,9 @@ void upnp::update_map(rootdevice& d, int i, mutex::scoped_lock& l)
|
||||||
{
|
{
|
||||||
if (d.upnp_connection) d.upnp_connection->close();
|
if (d.upnp_connection) d.upnp_connection->close();
|
||||||
d.upnp_connection.reset(new http_connection(m_io_service
|
d.upnp_connection.reset(new http_connection(m_io_service
|
||||||
, m_cc, bind(&upnp::on_upnp_unmap_response, self(), _1, _2
|
, m_cc, boost::bind(&upnp::on_upnp_unmap_response, self(), _1, _2
|
||||||
, boost::ref(d), i, _5), true
|
, boost::ref(d), i, _5), true
|
||||||
, bind(&upnp::delete_port_mapping, self(), boost::ref(d), i)));
|
, boost::bind(&upnp::delete_port_mapping, self(), boost::ref(d), i)));
|
||||||
d.upnp_connection->start(d.hostname, to_string(d.port).elems
|
d.upnp_connection->start(d.hostname, to_string(d.port).elems
|
||||||
, seconds(10), 1);
|
, seconds(10), 1);
|
||||||
}
|
}
|
||||||
|
@ -878,7 +877,7 @@ void upnp::on_upnp_xml(error_code const& e
|
||||||
parse_state s;
|
parse_state s;
|
||||||
s.reset("urn:schemas-upnp-org:service:WANIPConnection:1");
|
s.reset("urn:schemas-upnp-org:service:WANIPConnection:1");
|
||||||
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
|
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
|
||||||
, bind(&find_control_url, _1, _2, boost::ref(s)));
|
, boost::bind(&find_control_url, _1, _2, boost::ref(s)));
|
||||||
if (!s.control_url.empty())
|
if (!s.control_url.empty())
|
||||||
{
|
{
|
||||||
d.service_namespace = s.service_type;
|
d.service_namespace = s.service_type;
|
||||||
|
@ -890,7 +889,7 @@ void upnp::on_upnp_xml(error_code const& e
|
||||||
// a PPP connection
|
// a PPP connection
|
||||||
s.reset("urn:schemas-upnp-org:service:WANPPPConnection:1");
|
s.reset("urn:schemas-upnp-org:service:WANPPPConnection:1");
|
||||||
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
|
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
|
||||||
, bind(&find_control_url, _1, _2, boost::ref(s)));
|
, boost::bind(&find_control_url, _1, _2, boost::ref(s)));
|
||||||
if (!s.control_url.empty())
|
if (!s.control_url.empty())
|
||||||
{
|
{
|
||||||
d.service_namespace = s.service_type;
|
d.service_namespace = s.service_type;
|
||||||
|
@ -1041,7 +1040,7 @@ std::string upnp_error_category::message(int ev) const
|
||||||
error_code_t* end = error_codes + num_errors;
|
error_code_t* end = error_codes + num_errors;
|
||||||
error_code_t tmp = {ev, 0};
|
error_code_t tmp = {ev, 0};
|
||||||
error_code_t* e = std::lower_bound(error_codes, end, tmp
|
error_code_t* e = std::lower_bound(error_codes, end, tmp
|
||||||
, bind(&error_code_t::code, _1) < bind(&error_code_t::code, _2));
|
, boost::bind(&error_code_t::code, _1) < boost::bind(&error_code_t::code, _2));
|
||||||
if (e != end && e->code == ev)
|
if (e != end && e->code == ev)
|
||||||
{
|
{
|
||||||
return e->msg;
|
return e->msg;
|
||||||
|
@ -1119,7 +1118,7 @@ void upnp::on_upnp_map_response(error_code const& e
|
||||||
|
|
||||||
error_code_parse_state s;
|
error_code_parse_state s;
|
||||||
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
|
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
|
||||||
, bind(&find_error_code, _1, _2, boost::ref(s)));
|
, boost::bind(&find_error_code, _1, _2, boost::ref(s)));
|
||||||
|
|
||||||
if (s.error_code != -1)
|
if (s.error_code != -1)
|
||||||
{
|
{
|
||||||
|
@ -1189,7 +1188,7 @@ void upnp::on_upnp_map_response(error_code const& e
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_refresh_timer.expires_at(m.expires, ec);
|
m_refresh_timer.expires_at(m.expires, ec);
|
||||||
m_refresh_timer.async_wait(bind(&upnp::on_expire, self(), _1));
|
m_refresh_timer.async_wait(boost::bind(&upnp::on_expire, self(), _1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1208,7 +1207,7 @@ void upnp::return_error(int mapping, int code, mutex::scoped_lock& l)
|
||||||
error_code_t* end = error_codes + num_errors;
|
error_code_t* end = error_codes + num_errors;
|
||||||
error_code_t tmp = {code, 0};
|
error_code_t tmp = {code, 0};
|
||||||
error_code_t* e = std::lower_bound(error_codes, end, tmp
|
error_code_t* e = std::lower_bound(error_codes, end, tmp
|
||||||
, bind(&error_code_t::code, _1) < bind(&error_code_t::code, _2));
|
, boost::bind(&error_code_t::code, _1) < boost::bind(&error_code_t::code, _2));
|
||||||
std::string error_string = "UPnP mapping error ";
|
std::string error_string = "UPnP mapping error ";
|
||||||
error_string += to_string(code).elems;
|
error_string += to_string(code).elems;
|
||||||
if (e != end && e->code == code)
|
if (e != end && e->code == code)
|
||||||
|
@ -1299,7 +1298,7 @@ void upnp::on_expire(error_code const& e)
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
m_refresh_timer.expires_at(next_expire, ec);
|
m_refresh_timer.expires_at(next_expire, ec);
|
||||||
m_refresh_timer.async_wait(bind(&upnp::on_expire, self(), _1));
|
m_refresh_timer.async_wait(boost::bind(&upnp::on_expire, self(), _1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/parse_url.hpp"
|
#include "libtorrent/parse_url.hpp"
|
||||||
#include "libtorrent/peer_info.hpp"
|
#include "libtorrent/peer_info.hpp"
|
||||||
|
|
||||||
using boost::bind;
|
|
||||||
using boost::shared_ptr;
|
using boost::shared_ptr;
|
||||||
using libtorrent::aux::session_impl;
|
using libtorrent::aux::session_impl;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue