replace uses of boost::bind with std::bind and lambdas (#745)
This commit is contained in:
parent
748af6eec1
commit
96999ad67f
2
Jamfile
2
Jamfile
|
@ -495,7 +495,7 @@ variant test_release : release
|
|||
;
|
||||
variant test_debug : debug
|
||||
: <crypto>openssl <logging>on <disk-stats>on
|
||||
<allocator>debug <debug-iterators>on
|
||||
<allocator>debug
|
||||
<invariant-checks>full <boost-link>shared
|
||||
<export-extra>on <debug-iterators>on <threading>multi
|
||||
;
|
||||
|
|
|
@ -28,9 +28,9 @@ environment:
|
|||
include: '"c:\\openssl-1.0.1p-vs2015\\include"'
|
||||
- variant: test_debug
|
||||
compiler: gcc
|
||||
model: 64
|
||||
linkflags: '"-LC:\\OpenSSL-Win64\\lib64"'
|
||||
include: '"c:\\OpenSSL-Win64\\include"'
|
||||
model: 32
|
||||
linkflags: '"-LC:\\OpenSSL-Win32\\lib"'
|
||||
include: '"c:\\OpenSSL-Win32\\include"'
|
||||
|
||||
install:
|
||||
- if defined sim ( git submodule update --init --recursive )
|
||||
|
@ -59,7 +59,7 @@ install:
|
|||
- ps: '"using msvc : 14.0 ;`nusing gcc : : : <cxxflags>-std=c++11 ;`nusing python : 3.5 : c:\\Python35-x64 : c:\\Python35-x64\\include : c:\\Python35-x64\\libs ;`n" | Set-Content $env:HOMEDRIVE\$env:HOMEPATH\user-config.jam'
|
||||
- type %HOMEDRIVE%%HOMEPATH%\user-config.jam
|
||||
- cd %ROOT_DIRECTORY%
|
||||
- set PATH=c:\msys64\mingw64\bin;%PATH%
|
||||
- set PATH=c:\msys64\mingw32\bin;%PATH%
|
||||
- g++ --version
|
||||
- python --version
|
||||
- echo %ROOT_DIRECTORY%
|
||||
|
|
|
@ -30,7 +30,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
*/
|
||||
|
||||
#include <iterator>
|
||||
#include <cstdio> // for snprintf
|
||||
#include <cstdlib> // for atoi
|
||||
#include <cstring>
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
|
@ -40,17 +42,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#endif
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include "libtorrent/extensions/ut_metadata.hpp"
|
||||
#include "libtorrent/extensions/ut_pex.hpp"
|
||||
#include "libtorrent/extensions/smart_ban.hpp"
|
||||
|
@ -78,7 +69,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "session_view.hpp"
|
||||
#include "print.hpp"
|
||||
|
||||
using boost::bind;
|
||||
using libtorrent::total_milliseconds;
|
||||
|
||||
void sleep_ms(int milliseconds)
|
||||
|
@ -113,11 +103,7 @@ bool sleep_and_input(int* c, int sleep)
|
|||
|
||||
#else
|
||||
|
||||
#include <stdio.h> // for snprintf
|
||||
#include <stdlib.h> // for atoi
|
||||
|
||||
#include <termios.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
@ -381,8 +367,8 @@ FILE* g_log_file = 0;
|
|||
int peer_index(libtorrent::tcp::endpoint addr, std::vector<libtorrent::peer_info> const& peers)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
std::vector<peer_info>::const_iterator i = std::find_if(peers.begin()
|
||||
, peers.end(), boost::bind(&peer_info::ip, _1) == addr);
|
||||
std::vector<peer_info>::const_iterator i = std::find_if(peers.begin(), peers.end()
|
||||
, [&addr](peer_info const& pi) { return pi.ip == addr; });
|
||||
if (i == peers.end()) return -1;
|
||||
|
||||
return int(i - peers.begin());
|
||||
|
@ -594,8 +580,6 @@ void load_torrent(libtorrent::sha1_hash const& ih, std::vector<char>& buf, libto
|
|||
// if non-empty, a peer that will be added to all torrents
|
||||
std::string peer;
|
||||
|
||||
using boost::bind;
|
||||
|
||||
std::string path_to_url(std::string f)
|
||||
{
|
||||
std::string ret = "file://"
|
||||
|
@ -1058,9 +1042,11 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a
|
|||
hash_to_filename[st.info_hash]) + ".resume")), out);
|
||||
if (h.is_valid()
|
||||
&& non_files.find(h) == non_files.end()
|
||||
&& std::find_if(files.begin(), files.end()
|
||||
, boost::bind(&handles_t::value_type::second, _1) == h) == files.end())
|
||||
&& std::none_of(files.begin(), files.end()
|
||||
, [&h](handles_t::value_type const& hn) { return hn.second == h; }))
|
||||
{
|
||||
ses.remove_torrent(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (save_resume_data_failed_alert* p = alert_cast<save_resume_data_failed_alert>(a))
|
||||
|
@ -1074,9 +1060,11 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a
|
|||
}
|
||||
if (h.is_valid()
|
||||
&& non_files.find(h) == non_files.end()
|
||||
&& std::find_if(files.begin(), files.end()
|
||||
, boost::bind(&handles_t::value_type::second, _1) == h) == files.end())
|
||||
&& std::none_of(files.begin(), files.end()
|
||||
, [&h](handles_t::value_type const& hn) { return hn.second == h; }))
|
||||
{
|
||||
ses.remove_torrent(h);
|
||||
}
|
||||
}
|
||||
else if (torrent_paused_alert* p = alert_cast<torrent_paused_alert>(a))
|
||||
{
|
||||
|
@ -1146,7 +1134,7 @@ void print_piece(libtorrent::partial_piece_info* pp
|
|||
else if (pp->blocks[j].state == block_info::requested) color = snubbed ? esc("35;7") : esc("0");
|
||||
else { color = esc("0"); chr = ' '; }
|
||||
}
|
||||
if (last_color == 0 || strcmp(last_color, color) != 0)
|
||||
if (last_color == 0 || std::strcmp(last_color, color) != 0)
|
||||
{
|
||||
std::snprintf(str, sizeof(str), "%s%c", color, chr);
|
||||
out += str;
|
||||
|
@ -1271,7 +1259,7 @@ int main(int argc, char* argv[])
|
|||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(argv[i], "--list-settings") == 0)
|
||||
if (std::strcmp(argv[i], "--list-settings") == 0)
|
||||
{
|
||||
// print all libtorrent settings and exit
|
||||
print_settings(settings_pack::string_type_base
|
||||
|
@ -1308,8 +1296,8 @@ int main(int argc, char* argv[])
|
|||
settings.set_str(sett_name, value);
|
||||
break;
|
||||
case settings_pack::bool_type_base:
|
||||
if (strcmp(value, "0") == 0
|
||||
|| strcmp(value, "1") == 0)
|
||||
if (std::strcmp(value, "0") == 0
|
||||
|| std::strcmp(value, "1") == 0)
|
||||
{
|
||||
settings.set_bool(sett_name, atoi(value) != 0);
|
||||
}
|
||||
|
@ -1668,7 +1656,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
// also delete the .torrent file from the torrent directory
|
||||
handles_t::iterator i = std::find_if(files.begin(), files.end()
|
||||
, boost::bind(&handles_t::value_type::second, _1) == st.handle);
|
||||
, [&st] (handles_t::value_type const& hn) { return hn.second == st.handle; });
|
||||
if (i != files.end())
|
||||
{
|
||||
error_code err;
|
||||
|
@ -1957,11 +1945,13 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
h.get_download_queue(queue);
|
||||
|
||||
std::sort(queue.begin(), queue.end(), boost::bind(&partial_piece_info::piece_index, _1)
|
||||
< boost::bind(&partial_piece_info::piece_index, _2));
|
||||
std::sort(queue.begin(), queue.end()
|
||||
, [] (partial_piece_info const& lhs, partial_piece_info const& rhs)
|
||||
{ return lhs.piece_index < rhs.piece_index; });
|
||||
|
||||
std::sort(cs.pieces.begin(), cs.pieces.end(), boost::bind(&cached_piece_info::piece, _1)
|
||||
> boost::bind(&cached_piece_info::piece, _2));
|
||||
std::sort(cs.pieces.begin(), cs.pieces.end()
|
||||
, [](cached_piece_info const& lhs, cached_piece_info const& rhs)
|
||||
{ return lhs.piece < rhs.piece; });
|
||||
|
||||
int p = 0; // this is horizontal position
|
||||
for (std::vector<cached_piece_info>::iterator i = cs.pieces.begin();
|
||||
|
@ -1974,8 +1964,9 @@ int main(int argc, char* argv[])
|
|||
tmp.piece_index = i->piece;
|
||||
std::vector<partial_piece_info>::iterator ppi
|
||||
= std::lower_bound(queue.begin(), queue.end(), tmp
|
||||
, boost::bind(&partial_piece_info::piece_index, _1)
|
||||
< boost::bind(&partial_piece_info::piece_index, _2));
|
||||
, [](partial_piece_info const& lhs, partial_piece_info const& rhs)
|
||||
{ return lhs.piece_index < rhs.piece_index; });
|
||||
|
||||
if (ppi != queue.end() && ppi->piece_index == i->piece) pp = &*ppi;
|
||||
|
||||
print_piece(pp, &*i, peers, out);
|
||||
|
@ -2141,7 +2132,7 @@ int main(int argc, char* argv[])
|
|||
out += "\x1b[J";
|
||||
print(out.c_str());
|
||||
|
||||
fflush(stdout);
|
||||
std::fflush(stdout);
|
||||
|
||||
if (!monitor_dir.empty()
|
||||
&& next_dir_scan < clock_type::now())
|
||||
|
|
|
@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/file_pool.hpp"
|
||||
#include <cstring>
|
||||
#include <thread>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <array>
|
||||
#include <boost/detail/atomic_count.hpp>
|
||||
|
@ -59,6 +59,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
using namespace libtorrent;
|
||||
using namespace libtorrent::detail; // for write_* and read_*
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
void generate_block(boost::uint32_t* buffer, int piece, int start, int length)
|
||||
{
|
||||
boost::uint32_t fill = (piece << 8) | ((start / 0x4000) & 0xff);
|
||||
|
@ -200,7 +202,7 @@ struct peer_conn
|
|||
}
|
||||
}
|
||||
restarting = false;
|
||||
s.async_connect(endpoint, boost::bind(&peer_conn::on_connect, this, _1));
|
||||
s.async_connect(endpoint, std::bind(&peer_conn::on_connect, this, _1));
|
||||
}
|
||||
|
||||
tcp::socket s;
|
||||
|
@ -258,7 +260,7 @@ struct peer_conn
|
|||
std::generate(h + 48, h + 68, &rand);
|
||||
// for seeds, don't send the interested message
|
||||
boost::asio::async_write(s, boost::asio::buffer(h, (sizeof(handshake) - 1) - (seed ? 5 : 0))
|
||||
, boost::bind(&peer_conn::on_handshake, this, h, _1, _2));
|
||||
, std::bind(&peer_conn::on_handshake, this, h, _1, _2));
|
||||
}
|
||||
|
||||
void on_handshake(char* h, error_code const& ec, size_t)
|
||||
|
@ -272,7 +274,7 @@ struct peer_conn
|
|||
|
||||
// read handshake
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 68)
|
||||
, boost::bind(&peer_conn::on_handshake2, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_handshake2, this, _1, _2));
|
||||
}
|
||||
|
||||
void on_handshake2(error_code const& ec, size_t)
|
||||
|
@ -311,7 +313,7 @@ struct peer_conn
|
|||
write_uint8(1, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto, ptr - write_buf_proto)
|
||||
, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -327,7 +329,7 @@ struct peer_conn
|
|||
write_uint8(1, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer((char*)buffer, len + 10)
|
||||
, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,7 +343,7 @@ struct peer_conn
|
|||
|
||||
// read message
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 4)
|
||||
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
}
|
||||
|
||||
bool write_request()
|
||||
|
@ -391,7 +393,7 @@ struct peer_conn
|
|||
write_uint32(16 * 1024, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer(m, sizeof(msg) - 1)
|
||||
, boost::bind(&peer_conn::on_req_sent, this, m, _1, _2));
|
||||
, std::bind(&peer_conn::on_req_sent, this, m, _1, _2));
|
||||
|
||||
++outstanding_requests;
|
||||
++block;
|
||||
|
@ -462,7 +464,7 @@ struct peer_conn
|
|||
|
||||
// read message
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 4)
|
||||
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
}
|
||||
|
||||
void on_msg_length(error_code const& ec, size_t)
|
||||
|
@ -488,7 +490,7 @@ struct peer_conn
|
|||
return;
|
||||
}
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, length)
|
||||
, boost::bind(&peer_conn::on_message, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_message, this, _1, _2));
|
||||
}
|
||||
|
||||
void on_message(error_code const& ec, size_t bytes_transferred)
|
||||
|
@ -540,7 +542,7 @@ struct peer_conn
|
|||
{
|
||||
// read another message
|
||||
boost::asio::async_read(s, boost::asio::buffer(buffer, 4)
|
||||
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -698,7 +700,7 @@ struct peer_conn
|
|||
std::array<boost::asio::const_buffer, 2> vec;
|
||||
vec[0] = boost::asio::buffer(write_buf_proto, ptr - write_buf_proto);
|
||||
vec[1] = boost::asio::buffer(write_buffer, length);
|
||||
boost::asio::async_write(s, vec, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
boost::asio::async_write(s, vec, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
++blocks_sent;
|
||||
if (churn && (blocks_sent % churn) == 0 && seed) {
|
||||
outstanding_requests = 0;
|
||||
|
@ -713,7 +715,7 @@ struct peer_conn
|
|||
write_uint32(5, ptr);
|
||||
write_uint8(4, ptr);
|
||||
write_uint32(piece, ptr);
|
||||
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto, 9), boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto, 9), std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
#include <boost/function/function5.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
|
|
@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
@ -98,8 +98,10 @@ public:
|
|||
// store it in a shared_ptr
|
||||
boost::shared_ptr<handler_type> h(new handler_type(handler));
|
||||
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).data());
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
m_resolver.async_resolve(q, std::bind(
|
||||
&http_stream::name_lookup, this, _1, _2, h));
|
||||
}
|
||||
|
||||
|
|
|
@ -39,16 +39,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
#include "libtorrent/session_settings.hpp"
|
||||
#include "libtorrent/string_util.hpp"
|
||||
|
@ -118,8 +119,10 @@ public:
|
|||
// store it in a shaed_ptr
|
||||
boost::shared_ptr<handler_type> h(new handler_type(handler));
|
||||
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).data());
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
m_resolver.async_resolve(q, std::bind(
|
||||
&i2p_stream::do_connect, this, _1, _2, h));
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <fstream>
|
||||
#include <set>
|
||||
#include <numeric>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/smart_ptr/enable_shared_from_this.hpp>
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/pool/pool.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
|
|
@ -35,12 +35,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
#include "libtorrent/broadcast_socket.hpp" // for is_ip_address
|
||||
#include "libtorrent/assert.hpp"
|
||||
|
@ -135,8 +136,10 @@ public:
|
|||
#if defined TORRENT_ASIO_DEBUGGING
|
||||
add_outstanding_async("socks5_stream::name_lookup");
|
||||
#endif
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).data());
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
m_resolver.async_resolve(q, std::bind(
|
||||
&socks5_stream::name_lookup, this, _1, _2, h));
|
||||
}
|
||||
|
||||
|
@ -203,9 +206,11 @@ public:
|
|||
// store it in a shaed_ptr
|
||||
boost::shared_ptr<handler_type> h(new handler_type(handler));
|
||||
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
ADD_OUTSTANDING_ASYNC("socks5_stream::name_lookup");
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).data());
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
m_resolver.async_resolve(q, std::bind(
|
||||
&socks5_stream::name_lookup, this, _1, _2, h));
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/io_service.hpp"
|
||||
#include "libtorrent/aux_/openssl.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
|
||||
// openssl seems to believe it owns
|
||||
|
@ -112,8 +113,9 @@ public:
|
|||
// store it in a shared_ptr
|
||||
boost::shared_ptr<handler_type> h(new handler_type(handler));
|
||||
|
||||
using std::placeholders::_1;
|
||||
m_sock.next_layer().async_connect(endpoint
|
||||
, boost::bind(&ssl_stream::connected, this, _1, h));
|
||||
, std::bind(&ssl_stream::connected, this, _1, h));
|
||||
}
|
||||
|
||||
template <class Handler>
|
||||
|
@ -121,8 +123,9 @@ public:
|
|||
{
|
||||
// this is used for accepting SSL connections
|
||||
boost::shared_ptr<handler_type> h(new handler_type(handler));
|
||||
using std::placeholders::_1;
|
||||
m_sock.async_handshake(ssl::stream_base::server
|
||||
, boost::bind(&ssl_stream::handshake, this, _1, h));
|
||||
, std::bind(&ssl_stream::handshake, this, _1, h));
|
||||
}
|
||||
|
||||
void accept_handshake(error_code& ec)
|
||||
|
@ -317,8 +320,9 @@ private:
|
|||
return;
|
||||
}
|
||||
|
||||
using std::placeholders::_1;
|
||||
m_sock.async_handshake(ssl::stream_base::client
|
||||
, boost::bind(&ssl_stream::handshake, this, _1, h));
|
||||
, std::bind(&ssl_stream::handshake, this, _1, h));
|
||||
}
|
||||
|
||||
void handshake(error_code const& e, boost::shared_ptr<handler_type> h)
|
||||
|
|
|
@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/function/function2.hpp>
|
||||
|
||||
|
@ -301,13 +301,13 @@ public:
|
|||
{
|
||||
if (!endpoint.address().is_v4())
|
||||
{
|
||||
m_io_service.post(boost::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
|
||||
m_io_service.post(std::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_impl == 0)
|
||||
{
|
||||
m_io_service.post(boost::bind<void>(handler, boost::asio::error::not_connected, 0));
|
||||
m_io_service.post(std::bind<void>(handler, boost::asio::error::not_connected, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -320,14 +320,14 @@ public:
|
|||
{
|
||||
if (m_impl == 0)
|
||||
{
|
||||
m_io_service.post(boost::bind<void>(handler, boost::asio::error::not_connected, 0));
|
||||
m_io_service.post(std::bind<void>(handler, boost::asio::error::not_connected, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
TORRENT_ASSERT(!m_read_handler);
|
||||
if (m_read_handler)
|
||||
{
|
||||
m_io_service.post(boost::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
|
||||
m_io_service.post(std::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
|
||||
return;
|
||||
}
|
||||
std::size_t bytes_added = 0;
|
||||
|
@ -344,7 +344,7 @@ public:
|
|||
{
|
||||
// if we're reading 0 bytes, post handler immediately
|
||||
// asio's SSL layer depends on this behavior
|
||||
m_io_service.post(boost::bind<void>(handler, error_code(), 0));
|
||||
m_io_service.post(std::bind<void>(handler, error_code(), 0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ public:
|
|||
{
|
||||
if (m_impl == 0)
|
||||
{
|
||||
m_io_service.post(boost::bind<void>(handler, boost::asio::error::not_connected, 0));
|
||||
m_io_service.post(std::bind<void>(handler, boost::asio::error::not_connected, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ public:
|
|||
if (m_read_handler)
|
||||
{
|
||||
TORRENT_ASSERT_FAIL(); // we should never do this!
|
||||
m_io_service.post(boost::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
|
||||
m_io_service.post(std::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
|
||||
return;
|
||||
}
|
||||
m_read_handler = handler;
|
||||
|
@ -453,7 +453,7 @@ public:
|
|||
{
|
||||
if (m_impl == 0)
|
||||
{
|
||||
m_io_service.post(boost::bind<void>(handler
|
||||
m_io_service.post(std::bind<void>(handler
|
||||
, boost::asio::error::not_connected, 0));
|
||||
return;
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ public:
|
|||
TORRENT_ASSERT(!m_write_handler);
|
||||
if (m_write_handler)
|
||||
{
|
||||
m_io_service.post(boost::bind<void>(handler
|
||||
m_io_service.post(std::bind<void>(handler
|
||||
, boost::asio::error::operation_not_supported, 0));
|
||||
return;
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ public:
|
|||
{
|
||||
// if we're writing 0 bytes, post handler immediately
|
||||
// asio's SSL layer depends on this behavior
|
||||
m_io_service.post(boost::bind<void>(handler, error_code(), 0));
|
||||
m_io_service.post(std::bind<void>(handler, error_code(), 0));
|
||||
return;
|
||||
}
|
||||
m_write_handler = handler;
|
||||
|
|
|
@ -48,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
using namespace libtorrent;
|
||||
namespace lt = libtorrent;
|
||||
using namespace sim;
|
||||
using namespace std::placeholders;
|
||||
|
||||
#if !defined TORRENT_DISABLE_DHT
|
||||
|
||||
|
@ -106,7 +107,7 @@ TORRENT_TEST(dht_rate_limit)
|
|||
counters cnt;
|
||||
entry state;
|
||||
boost::shared_ptr<lt::dht::dht_tracker> dht = boost::make_shared<lt::dht::dht_tracker>(
|
||||
&o, boost::ref(dht_ios), boost::bind(&udp_socket::send, &sock, _1, _2, _3, _4)
|
||||
&o, boost::ref(dht_ios), std::bind(&udp_socket::send, &sock, _1, _2, _3, _4)
|
||||
, dhtsett, cnt, dht::dht_default_storage_constructor, state);
|
||||
|
||||
bool stop = false;
|
||||
|
|
|
@ -52,6 +52,8 @@ using namespace sim::asio;
|
|||
using sim::simulation;
|
||||
using sim::default_config;
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
||||
namespace
|
||||
|
@ -94,7 +96,7 @@ void test_expiration(high_resolution_clock::duration const& expiry_time
|
|||
|
||||
sim::asio::high_resolution_timer timer(ios);
|
||||
timer.expires_from_now(expiry_time);
|
||||
timer.async_wait(boost::bind(&timer_tick, s, c, _1));
|
||||
timer.async_wait(std::bind(&timer_tick, s, c, _1));
|
||||
|
||||
boost::system::error_code ec;
|
||||
sim.run(ec);
|
||||
|
|
|
@ -52,7 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
||||
#include "libtorrent/aux_/max_path.hpp" // for TORRENT_MAX_PATH
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
|
|
@ -40,15 +40,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/asio/ip/host_name.hpp>
|
||||
#include <boost/asio/ip/multicast.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#ifdef TORRENT_WINDOWS
|
||||
#include <iphlpapi.h> // for if_nametoindex
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/enum_net.hpp"
|
||||
|
@ -60,6 +61,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/socket_io.hpp"
|
||||
#endif
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
bool is_ip_address(char const* host)
|
||||
|
@ -243,7 +246,7 @@ namespace libtorrent
|
|||
socket_entry& se = m_sockets.back();
|
||||
ADD_OUTSTANDING_ASYNC("broadcast_socket::on_receive");
|
||||
s->async_receive_from(boost::asio::buffer(se.buffer, sizeof(se.buffer))
|
||||
, se.remote, boost::bind(&broadcast_socket::on_receive, this, &se, _1, _2));
|
||||
, se.remote, std::bind(&broadcast_socket::on_receive, this, &se, _1, _2));
|
||||
++m_outstanding_operations;
|
||||
}
|
||||
|
||||
|
@ -267,7 +270,7 @@ namespace libtorrent
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("broadcast_socket::on_receive");
|
||||
s->async_receive_from(boost::asio::buffer(se.buffer, sizeof(se.buffer))
|
||||
, se.remote, boost::bind(&broadcast_socket::on_receive, this, &se, _1, _2));
|
||||
, se.remote, std::bind(&broadcast_socket::on_receive, this, &se, _1, _2));
|
||||
++m_outstanding_operations;
|
||||
}
|
||||
|
||||
|
@ -336,7 +339,7 @@ namespace libtorrent
|
|||
if (!s->socket) return;
|
||||
ADD_OUTSTANDING_ASYNC("broadcast_socket::on_receive");
|
||||
s->socket->async_receive_from(boost::asio::buffer(s->buffer, sizeof(s->buffer))
|
||||
, s->remote, boost::bind(&broadcast_socket::on_receive, this, s, _1, _2));
|
||||
, s->remote, std::bind(&broadcast_socket::on_receive, this, s, _1, _2));
|
||||
++m_outstanding_operations;
|
||||
}
|
||||
|
||||
|
@ -356,8 +359,8 @@ namespace libtorrent
|
|||
|
||||
void broadcast_socket::close()
|
||||
{
|
||||
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(), boost::bind(&socket_entry::close, _1));
|
||||
std::for_each(m_sockets.begin(), m_sockets.end(), std::bind(&socket_entry::close, _1));
|
||||
std::for_each(m_unicast_sockets.begin(), m_unicast_sockets.end(), std::bind(&socket_entry::close, _1));
|
||||
|
||||
m_abort = true;
|
||||
maybe_abort();
|
||||
|
|
|
@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <vector>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
#include <memory> // autp_ptr
|
||||
|
|
|
@ -35,7 +35,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/session_settings.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -303,7 +305,7 @@ namespace libtorrent
|
|||
// if we're using the bittyrant choker, sort peers by their return
|
||||
// on investment. i.e. download rate / upload rate
|
||||
std::sort(peers.begin(), peers.end()
|
||||
, boost::bind(&bittyrant_unchoke_compare, _1, _2));
|
||||
, std::bind(&bittyrant_unchoke_compare, _1, _2));
|
||||
|
||||
int upload_capacity_left = max_upload_rate;
|
||||
|
||||
|
@ -350,7 +352,7 @@ namespace libtorrent
|
|||
// TODO: make the comparison function a free function and move it
|
||||
// into this cpp file
|
||||
std::sort(peers.begin(), peers.end()
|
||||
, boost::bind(&upload_rate_compare, _1, _2));
|
||||
, std::bind(&upload_rate_compare, _1, _2));
|
||||
|
||||
// TODO: make configurable
|
||||
int rate_threshold = 1024;
|
||||
|
@ -387,21 +389,21 @@ namespace libtorrent
|
|||
|
||||
std::partial_sort(peers.begin(), peers.begin()
|
||||
+ (std::min)(upload_slots, int(peers.size())), peers.end()
|
||||
, boost::bind(&unchoke_compare_rr, _1, _2, pieces));
|
||||
, std::bind(&unchoke_compare_rr, _1, _2, pieces));
|
||||
}
|
||||
else if (sett.get_int(settings_pack::seed_choking_algorithm)
|
||||
== settings_pack::fastest_upload)
|
||||
{
|
||||
std::partial_sort(peers.begin(), peers.begin()
|
||||
+ (std::min)(upload_slots, int(peers.size())), peers.end()
|
||||
, boost::bind(&unchoke_compare_fastest_upload, _1, _2));
|
||||
, std::bind(&unchoke_compare_fastest_upload, _1, _2));
|
||||
}
|
||||
else if (sett.get_int(settings_pack::seed_choking_algorithm)
|
||||
== settings_pack::anti_leech)
|
||||
{
|
||||
std::partial_sort(peers.begin(), peers.begin()
|
||||
+ (std::min)(upload_slots, int(peers.size())), peers.end()
|
||||
, boost::bind(&unchoke_compare_anti_leech, _1, _2));
|
||||
, std::bind(&unchoke_compare_anti_leech, _1, _2));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -410,7 +412,7 @@ namespace libtorrent
|
|||
int pieces = sett.get_int(settings_pack::seeding_piece_quota);
|
||||
std::partial_sort(peers.begin(), peers.begin()
|
||||
+ (std::min)(upload_slots, int(peers.size())), peers.end()
|
||||
, boost::bind(&unchoke_compare_rr, _1, _2, pieces));
|
||||
, std::bind(&unchoke_compare_rr, _1, _2, pieces));
|
||||
}
|
||||
|
||||
return upload_slots;
|
||||
|
|
|
@ -42,7 +42,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/performance_counters.hpp" // for counters
|
||||
#include "libtorrent/alert_manager.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
@ -50,6 +49,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
#define MAX_SYMLINK_PATH 200
|
||||
|
||||
namespace libtorrent
|
||||
|
@ -181,7 +184,7 @@ namespace libtorrent
|
|||
{
|
||||
iothread->async_hash(storage.get(), *piece_counter
|
||||
, disk_io_job::sequential_access
|
||||
, boost::bind(&on_hash, _1, t, storage, iothread
|
||||
, std::bind(&on_hash, _1, t, storage, iothread
|
||||
, piece_counter, completed_piece, f, ec), NULL);
|
||||
++(*piece_counter);
|
||||
}
|
||||
|
@ -303,7 +306,7 @@ namespace libtorrent
|
|||
for (int i = 0; i < piece_read_ahead; ++i)
|
||||
{
|
||||
disk_thread.async_hash(storage.get(), i, disk_io_job::sequential_access
|
||||
, boost::bind(&on_hash, _1, &t, storage, &disk_thread
|
||||
, std::bind(&on_hash, _1, &t, storage, &disk_thread
|
||||
, &piece_counter, &completed_piece, &f, &ec), NULL);
|
||||
++piece_counter;
|
||||
if (piece_counter >= t.num_pieces()) break;
|
||||
|
@ -684,7 +687,8 @@ namespace libtorrent
|
|||
m_urls.push_back(announce_entry(url, tier));
|
||||
|
||||
std::sort(m_urls.begin(), m_urls.end()
|
||||
, boost::bind(&announce_entry::second, _1) < boost::bind(&announce_entry::second, _2));
|
||||
, [] (announce_entry const& lhs, announce_entry const& rhs)
|
||||
{ return lhs.second < rhs.second; } );
|
||||
}
|
||||
|
||||
void create_torrent::set_root_cert(std::string const& cert)
|
||||
|
|
|
@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "libtorrent/platform_util.hpp"
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
@ -148,7 +148,7 @@ namespace libtorrent
|
|||
, m_last_cache_expiry(min_time())
|
||||
, m_last_file_check(clock_type::now())
|
||||
, m_file_pool(40)
|
||||
, m_disk_cache(block_size, ios, boost::bind(&disk_io_thread::trigger_cache_trim, this))
|
||||
, m_disk_cache(block_size, ios, std::bind(&disk_io_thread::trigger_cache_trim, this))
|
||||
, m_cache_check_state(cache_check_idle)
|
||||
, m_stats_counters(cnt)
|
||||
, m_ios(ios)
|
||||
|
@ -259,7 +259,7 @@ namespace libtorrent
|
|||
m_blocks_to_reclaim.push_back(ref);
|
||||
if (m_outstanding_reclaim_message) return;
|
||||
|
||||
m_ios.post(boost::bind(&disk_io_thread::commit_reclaimed_blocks, this));
|
||||
m_ios.post(std::bind(&disk_io_thread::commit_reclaimed_blocks, this));
|
||||
m_outstanding_reclaim_message = true;
|
||||
}
|
||||
|
||||
|
@ -3496,7 +3496,7 @@ namespace libtorrent
|
|||
// we take this lock just to make the logging prettier (non-interleaved)
|
||||
DLOG("posting job handlers (%d)\n", m_completed_jobs.size());
|
||||
#endif
|
||||
m_ios.post(boost::bind(&disk_io_thread::call_job_handlers, this, m_userdata));
|
||||
m_ios.post(std::bind(&disk_io_thread::call_job_handlers, this, m_userdata));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,17 +32,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#if TORRENT_USE_IOSTREAM
|
||||
#include <iostream>
|
||||
#endif
|
||||
#include <algorithm>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include "libtorrent/entry.hpp"
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#include "libtorrent/lazy_entry.hpp"
|
||||
#endif
|
||||
|
|
|
@ -37,12 +37,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/socket_type.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <stdlib.h> // for wcstombscstombs
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/asio/ip/host_name.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <vector>
|
||||
#include <stdlib.h> // for wcstombscstombs
|
||||
|
||||
#if TORRENT_USE_IFCONF
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -696,7 +697,7 @@ namespace libtorrent
|
|||
{
|
||||
std::vector<ip_route> ret = enum_routes(ios, ec);
|
||||
std::vector<ip_route>::iterator i = std::find_if(ret.begin(), ret.end()
|
||||
, boost::bind(&ip_route::destination, _1) == address());
|
||||
, [](ip_route const& r) { return r.destination == address(); });
|
||||
if (i == ret.end()) return address();
|
||||
return i->gateway;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
|
@ -248,8 +247,8 @@ namespace libtorrent
|
|||
void file_pool::remove_oldest(std::unique_lock<std::mutex>& l)
|
||||
{
|
||||
file_set::iterator i = std::min_element(m_files.begin(), m_files.end()
|
||||
, boost::bind(&lru_file_entry::last_use, boost::bind(&file_set::value_type::second, _1))
|
||||
< boost::bind(&lru_file_entry::last_use, boost::bind(&file_set::value_type::second, _2)));
|
||||
, [] (file_set::value_type const& lhs, file_set::value_type const& rhs)
|
||||
{ return lhs.second.last_use < rhs.second.last_use; });
|
||||
if (i == m_files.end()) return;
|
||||
|
||||
file_handle file_ptr = i->second.file_ptr;
|
||||
|
@ -267,7 +266,7 @@ namespace libtorrent
|
|||
|
||||
file_set::iterator i = m_files.find(std::make_pair(st, file_index));
|
||||
if (i == m_files.end()) return;
|
||||
|
||||
|
||||
file_handle file_ptr = i->second.file_ptr;
|
||||
m_files.erase(i);
|
||||
|
||||
|
|
|
@ -37,13 +37,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/crc.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#if defined(TORRENT_WINDOWS) || defined(TORRENT_OS2)
|
||||
#define TORRENT_SEPARATOR '\\'
|
||||
|
@ -51,6 +51,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
file_storage::file_storage()
|
||||
|
@ -198,7 +200,7 @@ namespace libtorrent
|
|||
// do we already have this path in the path list?
|
||||
std::vector<std::string>::reverse_iterator p
|
||||
= std::find_if(m_paths.rbegin(), m_paths.rend()
|
||||
, boost::bind(&compare_string, branch_path, branch_len, _1));
|
||||
, std::bind(&compare_string, branch_path, branch_len, _1));
|
||||
|
||||
if (p == m_paths.rend())
|
||||
{
|
||||
|
|
|
@ -44,13 +44,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/debug.hpp"
|
||||
#include "libtorrent/time.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
@ -143,7 +141,7 @@ void http_connection::get(std::string const& url, time_duration timeout, int pri
|
|||
|
||||
if (ec)
|
||||
{
|
||||
m_timer.get_io_service().post(boost::bind(&http_connection::callback
|
||||
m_timer.get_io_service().post(std::bind(&http_connection::callback
|
||||
, me, ec, static_cast<char*>(NULL), 0));
|
||||
return;
|
||||
}
|
||||
|
@ -155,7 +153,7 @@ void http_connection::get(std::string const& url, time_duration timeout, int pri
|
|||
)
|
||||
{
|
||||
error_code err(errors::unsupported_url_protocol);
|
||||
m_timer.get_io_service().post(boost::bind(&http_connection::callback
|
||||
m_timer.get_io_service().post(std::bind(&http_connection::callback
|
||||
, me, err, static_cast<char*>(NULL), 0));
|
||||
return;
|
||||
}
|
||||
|
@ -251,7 +249,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
m_timer.expires_from_now((std::min)(
|
||||
m_read_timeout, m_completion_timeout), ec);
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_timeout");
|
||||
m_timer.async_wait(boost::bind(&http_connection::on_timeout
|
||||
m_timer.async_wait(std::bind(&http_connection::on_timeout
|
||||
, boost::weak_ptr<http_connection>(me), _1));
|
||||
m_called = false;
|
||||
m_parser.reset();
|
||||
|
@ -261,7 +259,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
|
||||
if (ec)
|
||||
{
|
||||
m_timer.get_io_service().post(boost::bind(&http_connection::callback
|
||||
m_timer.get_io_service().post(std::bind(&http_connection::callback
|
||||
, me, ec, static_cast<char*>(NULL), 0));
|
||||
return;
|
||||
}
|
||||
|
@ -271,7 +269,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
{
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_write");
|
||||
async_write(m_sock, boost::asio::buffer(m_sendbuffer)
|
||||
, boost::bind(&http_connection::on_write, me, _1));
|
||||
, std::bind(&http_connection::on_write, me, _1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -299,7 +297,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
#if TORRENT_USE_I2P
|
||||
if (is_i2p && i2p_conn->proxy().type != settings_pack::i2p_proxy)
|
||||
{
|
||||
m_timer.get_io_service().post(boost::bind(&http_connection::callback
|
||||
m_timer.get_io_service().post(std::bind(&http_connection::callback
|
||||
, me, error_code(errors::no_i2p_router, get_libtorrent_category()), static_cast<char*>(NULL), 0));
|
||||
return;
|
||||
}
|
||||
|
@ -340,7 +338,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
m_ssl_ctx->set_verify_mode(ssl::context::verify_none, ec);
|
||||
if (ec)
|
||||
{
|
||||
m_timer.get_io_service().post(boost::bind(&http_connection::callback
|
||||
m_timer.get_io_service().post(std::bind(&http_connection::callback
|
||||
, me, ec, static_cast<char*>(NULL), 0));
|
||||
return;
|
||||
}
|
||||
|
@ -361,7 +359,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
m_sock.bind(tcp::endpoint(m_bind_addr, 0), ec);
|
||||
if (ec)
|
||||
{
|
||||
m_timer.get_io_service().post(boost::bind(&http_connection::callback
|
||||
m_timer.get_io_service().post(std::bind(&http_connection::callback
|
||||
, me, ec, static_cast<char*>(NULL), 0));
|
||||
return;
|
||||
}
|
||||
|
@ -370,7 +368,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
setup_ssl_hostname(m_sock, hostname, ec);
|
||||
if (ec)
|
||||
{
|
||||
m_timer.get_io_service().post(boost::bind(&http_connection::callback
|
||||
m_timer.get_io_service().post(std::bind(&http_connection::callback
|
||||
, me, ec, static_cast<char*>(NULL), 0));
|
||||
return;
|
||||
}
|
||||
|
@ -384,7 +382,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
if (hostname.length() < 516) // Base64 encoded destination with optional .i2p
|
||||
{
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_i2p_resolve");
|
||||
i2p_conn->async_name_lookup(hostname.c_str(), boost::bind(&http_connection::on_i2p_resolve
|
||||
i2p_conn->async_name_lookup(hostname.c_str(), std::bind(&http_connection::on_i2p_resolve
|
||||
, me, _1, _2));
|
||||
}
|
||||
else
|
||||
|
@ -405,7 +403,7 @@ void http_connection::start(std::string const& hostname, int port
|
|||
{
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_resolve");
|
||||
m_resolver.async_resolve(hostname, m_resolve_flags
|
||||
, boost::bind(&http_connection::on_resolve
|
||||
, std::bind(&http_connection::on_resolve
|
||||
, me, _1, _2));
|
||||
}
|
||||
m_hostname = hostname;
|
||||
|
@ -454,7 +452,7 @@ void http_connection::on_timeout(boost::weak_ptr<http_connection> p
|
|||
c->m_timer.expires_at((std::min)(
|
||||
c->m_last_receive + c->m_read_timeout
|
||||
, c->m_start_time + c->m_completion_timeout), ec);
|
||||
c->m_timer.async_wait(boost::bind(&http_connection::on_timeout, p, _1));
|
||||
c->m_timer.async_wait(std::bind(&http_connection::on_timeout, p, _1));
|
||||
}
|
||||
|
||||
void http_connection::close(bool force)
|
||||
|
@ -492,7 +490,7 @@ void http_connection::connect_i2p_tracker(char const* destination)
|
|||
m_sock.get<i2p_stream>()->set_session_id(m_i2p_conn->session_id());
|
||||
#endif
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_connect");
|
||||
m_sock.async_connect(tcp::endpoint(), boost::bind(&http_connection::on_connect
|
||||
m_sock.async_connect(tcp::endpoint(), std::bind(&http_connection::on_connect
|
||||
, shared_from_this(), _1));
|
||||
}
|
||||
|
||||
|
@ -542,8 +540,8 @@ void http_connection::on_resolve(error_code const& e
|
|||
// we'll talk to it from the same IP that we're listening on
|
||||
if (m_bind_addr != address_v4::any())
|
||||
std::partition(m_endpoints.begin(), m_endpoints.end()
|
||||
, boost::bind(&address::is_v4, boost::bind(&tcp::endpoint::address, _1))
|
||||
== m_bind_addr.is_v4());
|
||||
, [this] (tcp::endpoint const& ep)
|
||||
{ return ep.address().is_v4() == m_bind_addr.is_v4(); });
|
||||
#endif
|
||||
|
||||
connect();
|
||||
|
@ -597,7 +595,7 @@ void http_connection::connect()
|
|||
ADD_OUTSTANDING_ASYNC("http_connection::on_connect");
|
||||
TORRENT_ASSERT(!m_connecting);
|
||||
m_connecting = true;
|
||||
m_sock.async_connect(target_address, boost::bind(&http_connection::on_connect
|
||||
m_sock.async_connect(target_address, std::bind(&http_connection::on_connect
|
||||
, shared_from_this(), _1));
|
||||
}
|
||||
|
||||
|
@ -614,7 +612,7 @@ void http_connection::on_connect(error_code const& e)
|
|||
if (m_connect_handler) m_connect_handler(*this);
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_write");
|
||||
async_write(m_sock, boost::asio::buffer(m_sendbuffer)
|
||||
, boost::bind(&http_connection::on_write, shared_from_this(), _1));
|
||||
, std::bind(&http_connection::on_write, shared_from_this(), _1));
|
||||
}
|
||||
else if (m_next_ep < m_endpoints.size() && !m_abort)
|
||||
{
|
||||
|
@ -698,7 +696,7 @@ void http_connection::on_write(error_code const& e)
|
|||
ADD_OUTSTANDING_ASYNC("http_connection::on_read");
|
||||
m_sock.async_read_some(boost::asio::buffer(&m_recvbuffer[0] + m_read_pos
|
||||
, amount_to_read)
|
||||
, boost::bind(&http_connection::on_read
|
||||
, std::bind(&http_connection::on_read
|
||||
, shared_from_this(), _1, _2));
|
||||
}
|
||||
|
||||
|
@ -849,7 +847,7 @@ void http_connection::on_read(error_code const& e
|
|||
ADD_OUTSTANDING_ASYNC("http_connection::on_read");
|
||||
m_sock.async_read_some(boost::asio::buffer(&m_recvbuffer[0] + m_read_pos
|
||||
, amount_to_read)
|
||||
, boost::bind(&http_connection::on_read
|
||||
, std::bind(&http_connection::on_read
|
||||
, me, _1, _2));
|
||||
}
|
||||
|
||||
|
@ -879,14 +877,14 @@ void http_connection::on_assign_bandwidth(error_code const& e)
|
|||
ADD_OUTSTANDING_ASYNC("http_connection::on_read");
|
||||
m_sock.async_read_some(boost::asio::buffer(&m_recvbuffer[0] + m_read_pos
|
||||
, amount_to_read)
|
||||
, boost::bind(&http_connection::on_read
|
||||
, std::bind(&http_connection::on_read
|
||||
, shared_from_this(), _1, _2));
|
||||
|
||||
error_code ec;
|
||||
m_limiter_timer_active = true;
|
||||
m_limiter_timer.expires_from_now(milliseconds(250), ec);
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_assign_bandwidth");
|
||||
m_limiter_timer.async_wait(boost::bind(&http_connection::on_assign_bandwidth
|
||||
m_limiter_timer.async_wait(std::bind(&http_connection::on_assign_bandwidth
|
||||
, shared_from_this(), _1));
|
||||
}
|
||||
|
||||
|
@ -900,7 +898,7 @@ void http_connection::rate_limit(int limit)
|
|||
m_limiter_timer_active = true;
|
||||
m_limiter_timer.expires_from_now(milliseconds(250), ec);
|
||||
ADD_OUTSTANDING_ASYNC("http_connection::on_assign_bandwidth");
|
||||
m_limiter_timer.async_wait(boost::bind(&http_connection::on_assign_bandwidth
|
||||
m_limiter_timer.async_wait(std::bind(&http_connection::on_assign_bandwidth
|
||||
, shared_from_this(), _1));
|
||||
}
|
||||
m_rate_limit = limit;
|
||||
|
|
|
@ -32,12 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <cstdio> // for snprintf
|
||||
#include <cinttypes> // for PRId64 et.al.
|
||||
|
|
|
@ -34,6 +34,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/escape_string.hpp" // for base64encode
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -42,7 +46,7 @@ namespace libtorrent
|
|||
{
|
||||
if (handle_error(e, h)) return;
|
||||
|
||||
m_sock.async_connect(i->endpoint(), boost::bind(
|
||||
m_sock.async_connect(i->endpoint(), std::bind(
|
||||
&http_stream::connected, this, _1, h));
|
||||
}
|
||||
|
||||
|
@ -78,7 +82,7 @@ namespace libtorrent
|
|||
}
|
||||
write_string("\r\n", p);
|
||||
async_write(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&http_stream::handshake1, this, _1, h));
|
||||
, std::bind(&http_stream::handshake1, this, _1, h));
|
||||
}
|
||||
|
||||
void http_stream::handshake1(error_code const& e, boost::shared_ptr<handler_type> h)
|
||||
|
@ -88,7 +92,7 @@ namespace libtorrent
|
|||
// read one byte from the socket
|
||||
m_buffer.resize(1);
|
||||
async_read(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&http_stream::handshake2, this, _1, h));
|
||||
, std::bind(&http_stream::handshake2, this, _1, h));
|
||||
}
|
||||
|
||||
void http_stream::handshake2(error_code const& e, boost::shared_ptr<handler_type> h)
|
||||
|
@ -144,7 +148,7 @@ namespace libtorrent
|
|||
// read another byte from the socket
|
||||
m_buffer.resize(read_pos + 1);
|
||||
async_read(m_sock, boost::asio::buffer(&m_buffer[0] + read_pos, 1)
|
||||
, boost::bind(&http_stream::handshake2, this, _1, h));
|
||||
, std::bind(&http_stream::handshake2, this, _1, h));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,12 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/gzip.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <cctype>
|
||||
|
@ -62,6 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/ip_filter.hpp"
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -202,10 +198,10 @@ namespace libtorrent
|
|||
#endif
|
||||
|
||||
m_tracker_connection.reset(new http_connection(get_io_service(), m_man.host_resolver()
|
||||
, boost::bind(&http_tracker_connection::on_response, shared_from_this(), _1, _2, _3, _4)
|
||||
, std::bind(&http_tracker_connection::on_response, shared_from_this(), _1, _2, _3, _4)
|
||||
, true, settings.get_int(settings_pack::max_http_recv_buffer_size)
|
||||
, boost::bind(&http_tracker_connection::on_connect, shared_from_this(), _1)
|
||||
, boost::bind(&http_tracker_connection::on_filter, shared_from_this(), _1, _2)
|
||||
, std::bind(&http_tracker_connection::on_connect, shared_from_this(), _1)
|
||||
, std::bind(&http_tracker_connection::on_filter, shared_from_this(), _1, _2)
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
, tracker_req().ssl_ctx
|
||||
#endif
|
||||
|
|
|
@ -40,10 +40,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#if TORRENT_USE_I2P
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/debug.hpp"
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -140,7 +142,7 @@ namespace libtorrent
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("i2p_stream::on_sam_connect");
|
||||
m_sam_socket->async_connect(tcp::endpoint()
|
||||
, boost::bind(&i2p_connection::on_sam_connect, this, _1, handler, m_sam_socket));
|
||||
, std::bind(&i2p_connection::on_sam_connect, this, _1, handler, m_sam_socket));
|
||||
}
|
||||
|
||||
void i2p_connection::on_sam_connect(error_code const& ec, i2p_stream::handler_type const& h, boost::shared_ptr<i2p_stream>)
|
||||
|
@ -154,7 +156,7 @@ namespace libtorrent
|
|||
return;
|
||||
}
|
||||
|
||||
do_name_lookup("ME", boost::bind(&i2p_connection::set_local_endpoint, this, _1, _2, h));
|
||||
do_name_lookup("ME", std::bind(&i2p_connection::set_local_endpoint, this, _1, _2, h));
|
||||
}
|
||||
|
||||
void i2p_connection::set_local_endpoint(error_code const& ec, char const* dest
|
||||
|
@ -184,7 +186,7 @@ namespace libtorrent
|
|||
m_state = sam_name_lookup;
|
||||
m_sam_socket->set_name_lookup(name.c_str());
|
||||
boost::shared_ptr<i2p_stream::handler_type> h(new i2p_stream::handler_type(
|
||||
boost::bind(&i2p_connection::on_name_lookup, this, _1, handler, m_sam_socket)));
|
||||
std::bind(&i2p_connection::on_name_lookup, this, _1, handler, m_sam_socket)));
|
||||
m_sam_socket->send_name_lookup(h);
|
||||
}
|
||||
|
||||
|
@ -242,7 +244,7 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
ADD_OUTSTANDING_ASYNC("i2p_stream::connected");
|
||||
m_sock.async_connect(i->endpoint(), boost::bind(
|
||||
m_sock.async_connect(i->endpoint(), std::bind(
|
||||
&i2p_stream::connected, this, _1, h));
|
||||
}
|
||||
|
||||
|
@ -258,7 +260,7 @@ namespace libtorrent
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("i2p_stream::start_read_line");
|
||||
async_write(m_sock, boost::asio::buffer(cmd, sizeof(cmd) - 1)
|
||||
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
, std::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
// std::fprintf(stderr, ">>> %s", cmd);
|
||||
}
|
||||
|
||||
|
@ -271,7 +273,7 @@ namespace libtorrent
|
|||
ADD_OUTSTANDING_ASYNC("i2p_stream::read_line");
|
||||
m_buffer.resize(1);
|
||||
async_read(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&i2p_stream::read_line, this, _1, h));
|
||||
, std::bind(&i2p_stream::read_line, this, _1, h));
|
||||
}
|
||||
|
||||
void i2p_stream::read_line(error_code const& e, boost::shared_ptr<handler_type> h)
|
||||
|
@ -289,7 +291,7 @@ namespace libtorrent
|
|||
// read another byte from the socket
|
||||
m_buffer.resize(read_pos + 1);
|
||||
async_read(m_sock, boost::asio::buffer(&m_buffer[read_pos], 1)
|
||||
, boost::bind(&i2p_stream::read_line, this, _1, h));
|
||||
, std::bind(&i2p_stream::read_line, this, _1, h));
|
||||
return;
|
||||
}
|
||||
m_buffer[read_pos - 1] = 0;
|
||||
|
@ -441,7 +443,7 @@ namespace libtorrent
|
|||
m_buffer.resize(1);
|
||||
ADD_OUTSTANDING_ASYNC("i2p_stream::read_line");
|
||||
async_read(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&i2p_stream::read_line, this, _1, h));
|
||||
, std::bind(&i2p_stream::read_line, this, _1, h));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -458,7 +460,7 @@ namespace libtorrent
|
|||
// std::fprintf(stderr, ">>> %s", cmd);
|
||||
ADD_OUTSTANDING_ASYNC("i2p_stream::start_read_line");
|
||||
async_write(m_sock, boost::asio::buffer(cmd, size)
|
||||
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
, std::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
}
|
||||
|
||||
void i2p_stream::send_accept(boost::shared_ptr<handler_type> h)
|
||||
|
@ -470,7 +472,7 @@ namespace libtorrent
|
|||
// std::fprintf(stderr, ">>> %s", cmd);
|
||||
ADD_OUTSTANDING_ASYNC("i2p_stream::start_read_line");
|
||||
async_write(m_sock, boost::asio::buffer(cmd, size)
|
||||
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
, std::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
}
|
||||
|
||||
void i2p_stream::send_session_create(boost::shared_ptr<handler_type> h)
|
||||
|
@ -483,7 +485,7 @@ namespace libtorrent
|
|||
// std::fprintf(stderr, ">>> %s", cmd);
|
||||
ADD_OUTSTANDING_ASYNC("i2p_stream::start_read_line");
|
||||
async_write(m_sock, boost::asio::buffer(cmd, size)
|
||||
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
, std::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
}
|
||||
|
||||
void i2p_stream::send_name_lookup(boost::shared_ptr<handler_type> h)
|
||||
|
@ -495,7 +497,7 @@ namespace libtorrent
|
|||
// std::fprintf(stderr, ">>> %s", cmd);
|
||||
ADD_OUTSTANDING_ASYNC("i2p_stream::start_read_line");
|
||||
async_write(m_sock, boost::asio::buffer(cmd, size)
|
||||
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
, std::bind(&i2p_stream::start_read_line, this, _1, h));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/random.hpp" // for random()
|
||||
#include "libtorrent/aux_/time.hpp" // for aux::time_now()
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
ip_voter::ip_voter()
|
||||
|
@ -118,13 +116,13 @@ namespace libtorrent
|
|||
|
||||
// do we already have an entry for this external IP?
|
||||
std::vector<external_ip_t>::iterator i = std::find_if(m_external_addresses.begin()
|
||||
, m_external_addresses.end(), boost::bind(&external_ip_t::addr, _1) == ip);
|
||||
, m_external_addresses.end(), [&ip] (external_ip_t const& e) { return e.addr == ip; });
|
||||
|
||||
if (i == m_external_addresses.end())
|
||||
{
|
||||
// each IP only gets to add a new IP once
|
||||
if (m_external_address_voters.find(k)) return maybe_rotate();
|
||||
|
||||
|
||||
if (m_external_addresses.size() > 40)
|
||||
{
|
||||
if (random() % 100 < 50)
|
||||
|
@ -148,7 +146,7 @@ namespace libtorrent
|
|||
// add one more vote to this external IP
|
||||
if (!i->add_vote(k, source_type)) return maybe_rotate();
|
||||
++m_total_votes;
|
||||
|
||||
|
||||
if (m_valid_external) return maybe_rotate();
|
||||
|
||||
i = std::min_element(m_external_addresses.begin(), m_external_addresses.end());
|
||||
|
|
|
@ -34,14 +34,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <utility>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -429,13 +427,12 @@ namespace
|
|||
{
|
||||
// delete the least important one (i.e. the one
|
||||
// the fewest peers are announcing)
|
||||
// TODO: c++11 use a lambda here instead
|
||||
dht_mutable_table_t::iterator j = std::min_element(m_mutable_table.begin()
|
||||
, m_mutable_table.end()
|
||||
, boost::bind(&dht_immutable_item::num_announcers
|
||||
, boost::bind(&dht_mutable_table_t::value_type::second, _1))
|
||||
< boost::bind(&dht_immutable_item::num_announcers
|
||||
, boost::bind(&dht_mutable_table_t::value_type::second, _2)));
|
||||
, [] (dht_mutable_table_t::value_type const& lhs
|
||||
, dht_mutable_table_t::value_type const& rhs)
|
||||
{ return lhs.second.num_announcers < rhs.second.num_announcers; });
|
||||
|
||||
TORRENT_ASSERT(j != m_mutable_table.end());
|
||||
free(j->second.value);
|
||||
free(j->second.salt);
|
||||
|
@ -461,8 +458,6 @@ namespace
|
|||
boost::tie(i, boost::tuples::ignore) = m_mutable_table.insert(
|
||||
std::make_pair(target, to_add));
|
||||
m_counters.mutable_data += 1;
|
||||
|
||||
// std::fprintf(stderr, "added mutable item (%d)\n", int(m_mutable_table.size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -57,18 +57,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/function/function0.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
using boost::ref;
|
||||
using libtorrent::dht::node;
|
||||
using libtorrent::dht::node_id;
|
||||
using libtorrent::dht::packet_t;
|
||||
using libtorrent::dht::msg;
|
||||
using libtorrent::detail::write_endpoint;
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
|
@ -176,16 +176,16 @@ namespace libtorrent { namespace dht
|
|||
|
||||
m_connection_timer.expires_from_now(seconds(1), ec);
|
||||
m_connection_timer.async_wait(
|
||||
boost::bind(&dht_tracker::connection_timeout, self(), boost::ref(m_dht), _1));
|
||||
std::bind(&dht_tracker::connection_timeout, self(), std::ref(m_dht), _1));
|
||||
|
||||
#if TORRENT_USE_IPV6
|
||||
m_connection_timer6.expires_from_now(seconds(1), ec);
|
||||
m_connection_timer6.async_wait(
|
||||
boost::bind(&dht_tracker::connection_timeout, self(), boost::ref(m_dht6), _1));
|
||||
std::bind(&dht_tracker::connection_timeout, self(), std::ref(m_dht6), _1));
|
||||
#endif
|
||||
|
||||
m_refresh_timer.expires_from_now(seconds(5), ec);
|
||||
m_refresh_timer.async_wait(boost::bind(&dht_tracker::refresh_timeout, self(), _1));
|
||||
m_refresh_timer.async_wait(std::bind(&dht_tracker::refresh_timeout, self(), _1));
|
||||
m_dht.bootstrap(initial_nodes, f);
|
||||
#if TORRENT_USE_IPV6
|
||||
m_dht6.bootstrap(initial_nodes6, f);
|
||||
|
@ -235,7 +235,7 @@ namespace libtorrent { namespace dht
|
|||
deadline_timer& timer = m_connection_timer;
|
||||
#endif
|
||||
timer.expires_from_now(d, ec);
|
||||
timer.async_wait(boost::bind(&dht_tracker::connection_timeout, self(), boost::ref(n), _1));
|
||||
timer.async_wait(std::bind(&dht_tracker::connection_timeout, self(), std::ref(n), _1));
|
||||
}
|
||||
|
||||
void dht_tracker::refresh_timeout(error_code const& e)
|
||||
|
@ -254,7 +254,7 @@ namespace libtorrent { namespace dht
|
|||
error_code ec;
|
||||
m_refresh_timer.expires_from_now(seconds(5), ec);
|
||||
m_refresh_timer.async_wait(
|
||||
boost::bind(&dht_tracker::refresh_timeout, self(), _1));
|
||||
std::bind(&dht_tracker::refresh_timeout, self(), _1));
|
||||
}
|
||||
|
||||
void dht_tracker::refresh_key(error_code const& e)
|
||||
|
@ -263,7 +263,7 @@ namespace libtorrent { namespace dht
|
|||
|
||||
error_code ec;
|
||||
m_key_refresh_timer.expires_from_now(key_refresh, ec);
|
||||
m_key_refresh_timer.async_wait(boost::bind(&dht_tracker::refresh_key, self(), _1));
|
||||
m_key_refresh_timer.async_wait(std::bind(&dht_tracker::refresh_key, self(), _1));
|
||||
|
||||
m_dht.new_write_key();
|
||||
m_dht6.new_write_key();
|
||||
|
@ -389,9 +389,9 @@ namespace libtorrent { namespace dht
|
|||
{
|
||||
boost::shared_ptr<get_immutable_item_ctx>
|
||||
ctx = boost::make_shared<get_immutable_item_ctx>((TORRENT_USE_IPV6) ? 2 : 1);
|
||||
m_dht.get_item(target, boost::bind(&get_immutable_item_callback, _1, ctx, cb));
|
||||
m_dht.get_item(target, std::bind(&get_immutable_item_callback, _1, ctx, cb));
|
||||
#if TORRENT_USE_IPV6
|
||||
m_dht6.get_item(target, boost::bind(&get_immutable_item_callback, _1, ctx, cb));
|
||||
m_dht6.get_item(target, std::bind(&get_immutable_item_callback, _1, ctx, cb));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -403,9 +403,9 @@ namespace libtorrent { namespace dht
|
|||
{
|
||||
boost::shared_ptr<get_mutable_item_ctx>
|
||||
ctx = boost::make_shared<get_mutable_item_ctx>((TORRENT_USE_IPV6) ? 2 : 1);
|
||||
m_dht.get_item(key, salt, boost::bind(&get_mutable_item_callback, _1, _2, ctx, cb));
|
||||
m_dht.get_item(key, salt, std::bind(&get_mutable_item_callback, _1, _2, ctx, cb));
|
||||
#if TORRENT_USE_IPV6
|
||||
m_dht6.get_item(key, salt, boost::bind(&get_mutable_item_callback, _1, _2, ctx, cb));
|
||||
m_dht6.get_item(key, salt, std::bind(&get_mutable_item_callback, _1, _2, ctx, cb));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -419,10 +419,10 @@ namespace libtorrent { namespace dht
|
|||
|
||||
boost::shared_ptr<put_item_ctx>
|
||||
ctx = boost::make_shared<put_item_ctx>((TORRENT_USE_IPV6) ? 2 : 1);
|
||||
m_dht.put_item(target, data, boost::bind(&put_immutable_item_callback
|
||||
m_dht.put_item(target, data, std::bind(&put_immutable_item_callback
|
||||
, _1, ctx, cb));
|
||||
#if TORRENT_USE_IPV6
|
||||
m_dht6.put_item(target, data, boost::bind(&put_immutable_item_callback
|
||||
m_dht6.put_item(target, data, std::bind(&put_immutable_item_callback
|
||||
, _1, ctx, cb));
|
||||
#endif
|
||||
}
|
||||
|
@ -434,10 +434,10 @@ namespace libtorrent { namespace dht
|
|||
boost::shared_ptr<put_item_ctx>
|
||||
ctx = boost::make_shared<put_item_ctx>((TORRENT_USE_IPV6) ? 2 : 1);
|
||||
|
||||
m_dht.put_item(key, salt, boost::bind(&put_mutable_item_callback
|
||||
m_dht.put_item(key, salt, std::bind(&put_mutable_item_callback
|
||||
, _1, _2, ctx, cb), data_cb);
|
||||
#if TORRENT_USE_IPV6
|
||||
m_dht6.put_item(key, salt, boost::bind(&put_mutable_item_callback
|
||||
m_dht6.put_item(key, salt, std::bind(&put_mutable_item_callback
|
||||
, _1, _2, ctx, cb), data_cb);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -34,17 +34,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <utility>
|
||||
#include <cinttypes> // for PRId64 et.al.
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/function/function1.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
#include <libtorrent/hex.hpp> // to_hex, from_hex
|
||||
#include "libtorrent/hex.hpp" // to_hex, from_hex
|
||||
#endif
|
||||
|
||||
#include "libtorrent/io.hpp"
|
||||
|
@ -67,6 +67,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/kademlia/get_peers.hpp"
|
||||
#include "libtorrent/kademlia/get_item.hpp"
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
|
||||
|
@ -456,7 +458,7 @@ void node::announce(sha1_hash const& info_hash, int listen_port, int flags
|
|||
#endif
|
||||
|
||||
get_peers(info_hash, f
|
||||
, boost::bind(&announce_fun, _1, boost::ref(*this)
|
||||
, std::bind(&announce_fun, _1, std::ref(*this)
|
||||
, listen_port, info_hash, flags), flags & node::flag_seed);
|
||||
}
|
||||
|
||||
|
@ -490,7 +492,7 @@ void node::get_item(sha1_hash const& target
|
|||
#endif
|
||||
|
||||
boost::intrusive_ptr<dht::get_item> ta;
|
||||
ta.reset(new dht::get_item(*this, target, boost::bind(f, _1), find_data::nodes_callback()));
|
||||
ta.reset(new dht::get_item(*this, target, std::bind(f, _1), find_data::nodes_callback()));
|
||||
ta->start();
|
||||
}
|
||||
|
||||
|
@ -549,12 +551,12 @@ void node::put_item(sha1_hash const& target, entry const& data, boost::function<
|
|||
item i;
|
||||
i.assign(data);
|
||||
boost::intrusive_ptr<dht::put_data> put_ta;
|
||||
put_ta.reset(new dht::put_data(*this, boost::bind(f, _2)));
|
||||
put_ta.reset(new dht::put_data(*this, std::bind(f, _2)));
|
||||
put_ta->set_data(i);
|
||||
|
||||
boost::intrusive_ptr<dht::get_item> ta;
|
||||
ta.reset(new dht::get_item(*this, target, get_item::data_callback(),
|
||||
boost::bind(&put, _1, put_ta)));
|
||||
std::bind(&put, _1, put_ta)));
|
||||
ta->start();
|
||||
}
|
||||
|
||||
|
@ -576,8 +578,8 @@ void node::put_item(char const* pk, std::string const& salt
|
|||
|
||||
boost::intrusive_ptr<dht::get_item> ta;
|
||||
ta.reset(new dht::get_item(*this, pk, salt
|
||||
, boost::bind(&put_data_cb, _1, _2, put_ta, data_cb)
|
||||
, boost::bind(&put, _1, put_ta)));
|
||||
, std::bind(&put_data_cb, _1, _2, put_ta, data_cb)
|
||||
, std::bind(&put, _1, put_ta)));
|
||||
ta->start();
|
||||
}
|
||||
|
||||
|
@ -649,7 +651,7 @@ void node::tick()
|
|||
node_id target = m_id;
|
||||
make_id_secret(target);
|
||||
boost::intrusive_ptr<dht::bootstrap> r(new dht::bootstrap(*this, target
|
||||
, boost::bind(&nop)));
|
||||
, std::bind(&nop)));
|
||||
r->start();
|
||||
m_last_self_refresh = now;
|
||||
return;
|
||||
|
|
|
@ -55,11 +55,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
using boost::uint8_t;
|
||||
using namespace std::placeholders;
|
||||
|
||||
#if BOOST_VERSION <= 104700
|
||||
namespace boost {
|
||||
|
@ -714,7 +714,7 @@ routing_table::add_node_status_t routing_table::add_node_impl(node_entry e)
|
|||
|
||||
// if the node already exists, we don't need it
|
||||
j = std::find_if(b.begin(), b.end()
|
||||
, boost::bind(&node_entry::id, _1) == e.id);
|
||||
, [&e](node_entry const& ne) { return ne.id == e.id; });
|
||||
|
||||
if (j != b.end())
|
||||
{
|
||||
|
@ -734,7 +734,8 @@ routing_table::add_node_status_t routing_table::add_node_impl(node_entry e)
|
|||
// pull it out from there. We may add it back to the replacement
|
||||
// bucket, but we may also replace a node in the main bucket, now
|
||||
// that we have an updated RTT
|
||||
j = std::find_if(rb.begin(), rb.end(), boost::bind(&node_entry::id, _1) == e.id);
|
||||
j = std::find_if(rb.begin(), rb.end()
|
||||
, [&e](node_entry const& ne) { return ne.id == e.id; });
|
||||
if (j != rb.end())
|
||||
{
|
||||
// a new IP address just claimed this node-ID
|
||||
|
@ -813,7 +814,8 @@ ip_ok:
|
|||
// if the node we're trying to insert is considered pinged,
|
||||
// we may replace other nodes that aren't pinged
|
||||
|
||||
j = std::find_if(b.begin(), b.end(), boost::bind(&node_entry::pinged, _1) == false);
|
||||
j = std::find_if(b.begin(), b.end()
|
||||
, [](node_entry const& ne) { return ne.pinged() == false; });
|
||||
|
||||
if (j != b.end() && !j->pinged())
|
||||
{
|
||||
|
@ -832,8 +834,8 @@ ip_ok:
|
|||
// with nodes from that cache.
|
||||
|
||||
j = std::max_element(b.begin(), b.end()
|
||||
, boost::bind(&node_entry::fail_count, _1)
|
||||
< boost::bind(&node_entry::fail_count, _2));
|
||||
, [](node_entry const& lhs, node_entry const& rhs)
|
||||
{ return lhs.fail_count() < rhs.fail_count(); });
|
||||
TORRENT_ASSERT(j != b.end());
|
||||
|
||||
if (j->fail_count() > 0)
|
||||
|
@ -885,8 +887,8 @@ ip_ok:
|
|||
if (!nodes.empty())
|
||||
{
|
||||
j = *std::max_element(nodes.begin(), nodes.end()
|
||||
, boost::bind(&node_entry::rtt, boost::bind(&bucket_t::iterator::operator*, _1))
|
||||
< boost::bind(&node_entry::rtt, boost::bind(&bucket_t::iterator::operator*, _2)));
|
||||
, [](bucket_t::iterator lhs, bucket_t::iterator rhs)
|
||||
{ return lhs->rtt < rhs->rtt; });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -931,8 +933,8 @@ ip_ok:
|
|||
// and replace it
|
||||
|
||||
std::vector<bucket_t::iterator>::iterator k = std::max_element(nodes.begin(), nodes.end()
|
||||
, boost::bind(&node_entry::rtt, boost::bind(&bucket_t::iterator::operator*, _1))
|
||||
< boost::bind(&node_entry::rtt, boost::bind(&bucket_t::iterator::operator*, _2)));
|
||||
, [](bucket_t::iterator lhs, bucket_t::iterator rhs)
|
||||
{ return lhs->rtt < rhs->rtt; });
|
||||
|
||||
// in this case, we would really rather replace the node even if
|
||||
// the new node has higher RTT, becase it fills a new prefix that we otherwise
|
||||
|
@ -943,8 +945,8 @@ ip_ok:
|
|||
else
|
||||
{
|
||||
j = std::max_element(b.begin(), b.end()
|
||||
, boost::bind(&node_entry::rtt, _1)
|
||||
< boost::bind(&node_entry::rtt, _2));
|
||||
, [](node_entry const& lhs, node_entry const& rhs)
|
||||
{ return lhs.rtt < rhs.rtt; });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -978,7 +980,7 @@ ip_ok:
|
|||
// and then replace it.
|
||||
|
||||
j = std::find_if(rb.begin(), rb.end()
|
||||
, boost::bind(&node_entry::id, _1) == e.id);
|
||||
, [&e](node_entry const& ne) { return ne.id == e.id; });
|
||||
|
||||
// if the node is already in the replacement bucket
|
||||
// just return.
|
||||
|
@ -995,7 +997,8 @@ ip_ok:
|
|||
// if the replacement bucket is full, remove the oldest entry
|
||||
// but prefer nodes that haven't been pinged, since they are
|
||||
// less reliable than this one, that has been pinged
|
||||
j = std::find_if(rb.begin(), rb.end(), boost::bind(&node_entry::pinged, _1) == false);
|
||||
j = std::find_if(rb.begin(), rb.end()
|
||||
, [] (node_entry const& ne) { return ne.pinged() == false; });
|
||||
if (j == rb.end()) j = rb.begin();
|
||||
m_ips.erase(j->addr());
|
||||
rb.erase(j);
|
||||
|
@ -1150,12 +1153,12 @@ void routing_table::node_failed(node_id const& nid, udp::endpoint const& ep)
|
|||
bucket_t& rb = i->replacements;
|
||||
|
||||
bucket_t::iterator j = std::find_if(b.begin(), b.end()
|
||||
, boost::bind(&node_entry::id, _1) == nid);
|
||||
, [&nid](node_entry const& ne) { return ne.id == nid; });
|
||||
|
||||
if (j == b.end())
|
||||
{
|
||||
j = std::find_if(rb.begin(), rb.end()
|
||||
, boost::bind(&node_entry::id, _1) == nid);
|
||||
, [&nid](node_entry const& ne) { return ne.id == nid; });
|
||||
|
||||
if (j == rb.end()
|
||||
|| j->ep() != ep) return;
|
||||
|
@ -1209,9 +1212,10 @@ void routing_table::node_failed(node_id const& nid, udp::endpoint const& ep)
|
|||
// sort by RTT first, to find the node with the lowest
|
||||
// RTT that is pinged
|
||||
std::sort(rb.begin(), rb.end()
|
||||
, boost::bind(&node_entry::rtt, _1) < boost::bind(&node_entry::rtt, _2));
|
||||
, [](node_entry const& lhs, node_entry const& rhs)
|
||||
{ return lhs.rtt < rhs.rtt; });
|
||||
|
||||
j = std::find_if(rb.begin(), rb.end(), boost::bind(&node_entry::pinged, _1));
|
||||
j = std::find_if(rb.begin(), rb.end(), std::bind(&node_entry::pinged, _1));
|
||||
if (j == rb.end()) j = rb.begin();
|
||||
b.push_back(*j);
|
||||
rb.erase(j);
|
||||
|
@ -1268,9 +1272,8 @@ void routing_table::find_node(node_id const& target
|
|||
}
|
||||
else
|
||||
{
|
||||
std::remove_copy_if(b.begin(), b.end()
|
||||
, std::back_inserter(l)
|
||||
, !boost::bind(&node_entry::confirmed, _1));
|
||||
std::remove_copy_if(b.begin(), b.end(), std::back_inserter(l)
|
||||
, [](node_entry const& ne) { return ne.confirmed() == false; });
|
||||
}
|
||||
|
||||
if (int(l.size()) == count) return;
|
||||
|
@ -1278,9 +1281,9 @@ void routing_table::find_node(node_id const& target
|
|||
if (int(l.size()) > count)
|
||||
{
|
||||
// sort the nodes by how close they are to the target
|
||||
std::sort(l.begin() + unsorted_start_idx, l.end(), boost::bind(&compare_ref
|
||||
, boost::bind(&node_entry::id, _1)
|
||||
, boost::bind(&node_entry::id, _2), target));
|
||||
std::sort(l.begin() + unsorted_start_idx, l.end()
|
||||
, [&target](node_entry const& lhs, node_entry const& rhs)
|
||||
{ return compare_ref(lhs.id, rhs.id, target); });
|
||||
|
||||
l.resize(count);
|
||||
return;
|
||||
|
@ -1309,7 +1312,7 @@ void routing_table::find_node(node_id const& target
|
|||
else
|
||||
{
|
||||
std::remove_copy_if(b.begin(), b.end(), std::back_inserter(l)
|
||||
, !boost::bind(&node_entry::confirmed, _1));
|
||||
, [](node_entry const& ne) { return ne.confirmed() == false; });
|
||||
}
|
||||
|
||||
if (int(l.size()) == count) return;
|
||||
|
@ -1317,9 +1320,9 @@ void routing_table::find_node(node_id const& target
|
|||
if (int(l.size()) > count)
|
||||
{
|
||||
// sort the nodes by how close they are to the target
|
||||
std::sort(l.begin() + unsorted_start_idx, l.end(), boost::bind(&compare_ref
|
||||
, boost::bind(&node_entry::id, _1)
|
||||
, boost::bind(&node_entry::id, _2), target));
|
||||
std::sort(l.begin() + unsorted_start_idx, l.end()
|
||||
, [&target](node_entry const& lhs, node_entry const& rhs)
|
||||
{ return compare_ref(lhs.id, rhs.id, target); });
|
||||
|
||||
l.resize(count);
|
||||
return;
|
||||
|
|
|
@ -33,12 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <libtorrent/io.hpp>
|
||||
#include <libtorrent/random.hpp>
|
||||
#include <libtorrent/invariant_check.hpp>
|
||||
|
@ -66,6 +60,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cinttypes> // for PRId64 et.al.
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
|
||||
|
@ -438,8 +436,8 @@ time_duration rpc_manager::tick()
|
|||
++i;
|
||||
}
|
||||
|
||||
std::for_each(timeouts.begin(), timeouts.end(), boost::bind(&observer::timeout, _1));
|
||||
std::for_each(short_timeouts.begin(), short_timeouts.end(), boost::bind(&observer::short_timeout, _1));
|
||||
std::for_each(timeouts.begin(), timeouts.end(), std::bind(&observer::timeout, _1));
|
||||
std::for_each(short_timeouts.begin(), short_timeouts.end(), std::bind(&observer::short_timeout, _1));
|
||||
|
||||
return (std::max)(ret, duration_cast<time_duration>(milliseconds(200)));
|
||||
}
|
||||
|
|
|
@ -46,7 +46,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/hex.hpp> // to_hex, from_hex
|
||||
#endif
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
|
@ -107,16 +109,9 @@ traversal_algorithm::traversal_algorithm(
|
|||
|
||||
void traversal_algorithm::resort_results()
|
||||
{
|
||||
std::sort(
|
||||
m_results.begin()
|
||||
, m_results.end()
|
||||
, boost::bind(
|
||||
compare_ref
|
||||
, boost::bind(&observer::id, _1)
|
||||
, boost::bind(&observer::id, _2)
|
||||
, m_target
|
||||
)
|
||||
);
|
||||
std::sort(m_results.begin(), m_results.end()
|
||||
, [this](observer_ptr const& lhs, observer_ptr const& rhs)
|
||||
{ return compare_ref(lhs->id(), rhs->id(), m_target); });
|
||||
}
|
||||
|
||||
void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsigned char flags)
|
||||
|
@ -145,24 +140,13 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
|
|||
o->flags |= flags;
|
||||
|
||||
TORRENT_ASSERT(libtorrent::dht::is_sorted(m_results.begin(), m_results.end()
|
||||
, boost::bind(
|
||||
compare_ref
|
||||
, boost::bind(&observer::id, _1)
|
||||
, boost::bind(&observer::id, _2)
|
||||
, m_target)
|
||||
));
|
||||
, [this](observer_ptr const& lhs, observer_ptr const& rhs)
|
||||
{ return compare_ref(lhs->id(), rhs->id(), m_target); }));
|
||||
|
||||
std::vector<observer_ptr>::iterator iter = std::lower_bound(
|
||||
m_results.begin()
|
||||
, m_results.end()
|
||||
, o
|
||||
, boost::bind(
|
||||
compare_ref
|
||||
, boost::bind(&observer::id, _1)
|
||||
, boost::bind(&observer::id, _2)
|
||||
, m_target
|
||||
)
|
||||
);
|
||||
m_results.begin(), m_results.end(), o
|
||||
, [this](observer_ptr const& lhs, observer_ptr const& rhs)
|
||||
{ return compare_ref(lhs->id(), rhs->id(), m_target); });
|
||||
|
||||
if (iter == m_results.end() || (*iter)->id() != id)
|
||||
{
|
||||
|
@ -209,8 +193,8 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
|
|||
add_result:
|
||||
|
||||
TORRENT_ASSERT((o->flags & observer::flag_no_id)
|
||||
|| std::find_if(m_results.begin(), m_results.end()
|
||||
, boost::bind(&observer::id, _1) == id) == m_results.end());
|
||||
|| std::none_of(m_results.begin(), m_results.end()
|
||||
, [&id](observer_ptr const& ob) { return ob->id() == id; }));
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
if (get_node().observer())
|
||||
|
@ -226,12 +210,8 @@ void traversal_algorithm::add_entry(node_id const& id, udp::endpoint addr, unsig
|
|||
iter = m_results.insert(iter, o);
|
||||
|
||||
TORRENT_ASSERT(libtorrent::dht::is_sorted(m_results.begin(), m_results.end()
|
||||
, boost::bind(
|
||||
compare_ref
|
||||
, boost::bind(&observer::id, _1)
|
||||
, boost::bind(&observer::id, _2)
|
||||
, m_target)
|
||||
));
|
||||
, [this](observer_ptr const& lhs, observer_ptr const& rhs)
|
||||
{ return compare_ref(lhs->id(), rhs->id(), m_target); }));
|
||||
}
|
||||
|
||||
if (m_results.size() > 100)
|
||||
|
@ -301,8 +281,7 @@ void traversal_algorithm::traverse(node_id const& id, udp::endpoint addr)
|
|||
void traversal_algorithm::finished(observer_ptr o)
|
||||
{
|
||||
#ifdef TORRENT_DEBUG
|
||||
std::vector<observer_ptr>::iterator i = std::find(
|
||||
m_results.begin(), m_results.end(), o);
|
||||
auto i = std::find(m_results.begin(), m_results.end(), o);
|
||||
|
||||
TORRENT_ASSERT(i != m_results.end() || m_results.size() == 100);
|
||||
#endif
|
||||
|
|
13
src/lsd.cpp
13
src/lsd.cpp
|
@ -45,13 +45,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/asio/ip/host_name.hpp>
|
||||
#include <boost/asio/ip/multicast.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <cstdarg>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
namespace {
|
||||
|
@ -110,12 +115,12 @@ void lsd::debug_log(char const* fmt, ...) const
|
|||
|
||||
void lsd::start(error_code& ec)
|
||||
{
|
||||
m_socket.open(boost::bind(&lsd::on_announce, self(), _1, _2, _3)
|
||||
m_socket.open(std::bind(&lsd::on_announce, self(), _1, _2, _3)
|
||||
, m_broadcast_timer.get_io_service(), ec);
|
||||
if (ec) return;
|
||||
|
||||
#if TORRENT_USE_IPV6
|
||||
m_socket6.open(boost::bind(&lsd::on_announce, self(), _1, _2, _3)
|
||||
m_socket6.open(std::bind(&lsd::on_announce, self(), _1, _2, _3)
|
||||
, m_broadcast_timer.get_io_service(), ec);
|
||||
#endif
|
||||
}
|
||||
|
@ -188,7 +193,7 @@ void lsd::announce_impl(sha1_hash const& ih, int listen_port, bool broadcast
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("lsd::resend_announce");
|
||||
m_broadcast_timer.expires_from_now(seconds(2 * retry_count), ec);
|
||||
m_broadcast_timer.async_wait(boost::bind(&lsd::resend_announce, self(), _1
|
||||
m_broadcast_timer.async_wait(std::bind(&lsd::resend_announce, self(), _1
|
||||
, ih, listen_port, retry_count));
|
||||
}
|
||||
|
||||
|
|
|
@ -35,15 +35,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <numeric>
|
||||
#include <cstdio>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/bt_peer_connection.hpp"
|
||||
#include "libtorrent/peer_connection_handle.hpp"
|
||||
|
@ -58,6 +58,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/torrent_handle.hpp"
|
||||
#include "libtorrent/announce_entry.hpp"
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent { namespace
|
||||
{
|
||||
|
||||
|
@ -93,17 +95,17 @@ namespace libtorrent { namespace
|
|||
entry tex;
|
||||
entry::list_type& added = tex["added"].list();
|
||||
std::vector<announce_entry> const& trackers = m_torrent.trackers();
|
||||
for (std::vector<announce_entry>::const_iterator i = trackers.begin()
|
||||
, end(trackers.end()); i != end; ++i)
|
||||
for (auto const& ent : trackers)
|
||||
{
|
||||
std::vector<announce_entry>::const_iterator k = std::find_if(
|
||||
m_old_trackers.begin(), m_old_trackers.end()
|
||||
, boost::bind(&announce_entry::url, _1) == i->url);
|
||||
if (k != m_old_trackers.end()) continue;
|
||||
if (!send_tracker(*i)) continue;
|
||||
m_old_trackers.push_back(*i);
|
||||
if (std::any_of(m_old_trackers.begin(), m_old_trackers.end()
|
||||
, [&ent](announce_entry const& ae) { return ae.url == ent.url; }))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!send_tracker(ent)) continue;
|
||||
m_old_trackers.push_back(ent);
|
||||
++m_updates;
|
||||
added.push_back(i->url);
|
||||
added.push_back(ent.url);
|
||||
}
|
||||
m_lt_trackers_msg.clear();
|
||||
bencode(std::back_inserter(m_lt_trackers_msg), tex);
|
||||
|
@ -114,12 +116,12 @@ namespace libtorrent { namespace
|
|||
{
|
||||
std::vector<std::string> canonical_list;
|
||||
std::transform(m_old_trackers.begin(), m_old_trackers.end(), back_inserter(canonical_list)
|
||||
, boost::bind(&announce_entry::url, _1));
|
||||
, [] (announce_entry const& ae) { return ae.url; });
|
||||
std::sort(canonical_list.begin(), canonical_list.end());
|
||||
|
||||
hasher h;
|
||||
std::for_each(canonical_list.begin(), canonical_list.end()
|
||||
, boost::bind(&hasher::update, &h, _1));
|
||||
, [&h](std::string const& s) { h.update(s); });
|
||||
m_list_hash = h.final();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <numeric>
|
||||
#include <algorithm> // count
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/bt_peer_connection.hpp"
|
||||
#include "libtorrent/peer_connection_handle.hpp"
|
||||
|
|
|
@ -38,13 +38,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/asio/ip/host_name.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <cstdio> // for snprintf
|
||||
#include <cstdarg>
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/natpmp.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
|
@ -62,8 +62,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <iostream>
|
||||
#endif
|
||||
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
natpmp::natpmp(io_service& ios
|
||||
, portmap_callback_t const& cb, log_callback_t const& lcb)
|
||||
|
@ -126,7 +126,7 @@ void natpmp::start()
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("natpmp::on_reply");
|
||||
m_socket.async_receive_from(boost::asio::buffer(&m_response_buffer, 16)
|
||||
, m_remote, boost::bind(&natpmp::on_reply, self(), _1, _2));
|
||||
, m_remote, std::bind(&natpmp::on_reply, self(), _1, _2));
|
||||
send_get_ip_address_request();
|
||||
|
||||
for (std::vector<mapping_t>::iterator i = m_mappings.begin()
|
||||
|
@ -231,7 +231,7 @@ int natpmp::add_mapping(protocol_type p, int external_port, int local_port)
|
|||
if (m_disabled) return -1;
|
||||
|
||||
std::vector<mapping_t>::iterator i = std::find_if(m_mappings.begin()
|
||||
, m_mappings.end(), boost::bind(&mapping_t::protocol, _1) == int(none));
|
||||
, m_mappings.end(), [] (mapping_t const& m) { return m.protocol == none; });
|
||||
if (i == m_mappings.end())
|
||||
{
|
||||
m_mappings.push_back(mapping_t());
|
||||
|
@ -288,7 +288,7 @@ void natpmp::try_next_mapping(int i)
|
|||
|
||||
std::vector<mapping_t>::iterator m = std::find_if(
|
||||
m_mappings.begin(), m_mappings.end()
|
||||
, boost::bind(&mapping_t::action, _1) != int(mapping_t::action_none));
|
||||
, [] (mapping_t const& ma) { return ma.action != mapping_t::action_none; });
|
||||
|
||||
if (m == m_mappings.end())
|
||||
{
|
||||
|
@ -392,7 +392,7 @@ void natpmp::send_map_request(int i)
|
|||
// linear back-off instead of exponential
|
||||
++m_retry_count;
|
||||
m_send_timer.expires_from_now(milliseconds(250 * m_retry_count), ec);
|
||||
m_send_timer.async_wait(boost::bind(&natpmp::resend_request, self(), i, _1));
|
||||
m_send_timer.async_wait(std::bind(&natpmp::resend_request, self(), i, _1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ void natpmp::on_reply(error_code const& e
|
|||
memcpy(msg_buf, m_response_buffer, bytes_transferred);
|
||||
|
||||
m_socket.async_receive_from(boost::asio::buffer(&m_response_buffer, 16)
|
||||
, m_remote, boost::bind(&natpmp::on_reply, self(), _1, _2));
|
||||
, m_remote, std::bind(&natpmp::on_reply, self(), _1, _2));
|
||||
|
||||
if (m_remote != m_nat_endpoint)
|
||||
{
|
||||
|
@ -646,7 +646,7 @@ void natpmp::update_expiration_timer()
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("natpmp::mapping_expired");
|
||||
m_refresh_timer.expires_from_now(min_expire - now, ec);
|
||||
m_refresh_timer.async_wait(boost::bind(&natpmp::mapping_expired, self(), _1, min_index));
|
||||
m_refresh_timer.async_wait(std::bind(&natpmp::mapping_expired, self(), _1, min_index));
|
||||
m_next_refresh = min_index;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
|
@ -87,6 +87,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
//#define TORRENT_CORRUPT_DATA
|
||||
|
||||
using boost::shared_ptr;
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -404,7 +405,7 @@ namespace libtorrent
|
|||
#endif
|
||||
|
||||
m_socket->async_connect(m_remote
|
||||
, boost::bind(&peer_connection::on_connection_complete, self(), _1));
|
||||
, std::bind(&peer_connection::on_connection_complete, self(), _1));
|
||||
m_connect = aux::time_now();
|
||||
|
||||
sent_syn(m_remote.address().is_v6());
|
||||
|
@ -431,7 +432,7 @@ namespace libtorrent
|
|||
// to not trigger another one. This effectively defer
|
||||
// the update until the current message queue is
|
||||
// flushed
|
||||
m_ios.post(boost::bind(&peer_connection::do_update_interest, self()));
|
||||
m_ios.post(std::bind(&peer_connection::do_update_interest, self()));
|
||||
}
|
||||
m_need_interest_update = true;
|
||||
}
|
||||
|
@ -1452,7 +1453,7 @@ namespace libtorrent
|
|||
|
||||
std::vector<pending_block>::iterator dlq_iter = std::find_if(
|
||||
m_download_queue.begin(), m_download_queue.end()
|
||||
, boost::bind(match_request, boost::cref(r), boost::bind(&pending_block::block, _1)
|
||||
, std::bind(match_request, boost::cref(r), std::bind(&pending_block::block, _1)
|
||||
, t->block_size()));
|
||||
|
||||
if (dlq_iter != m_download_queue.end())
|
||||
|
@ -2839,7 +2840,7 @@ namespace libtorrent
|
|||
}
|
||||
t->inc_refcount("async_write");
|
||||
m_disk_thread.async_write(&t->storage(), p, data
|
||||
, boost::bind(&peer_connection::on_disk_write_complete
|
||||
, std::bind(&peer_connection::on_disk_write_complete
|
||||
, self(), _1, p, t));
|
||||
|
||||
boost::uint64_t write_queue_size = m_counters.inc_stats_counter(
|
||||
|
@ -5184,7 +5185,7 @@ namespace libtorrent
|
|||
if (!t->need_loaded()) return;
|
||||
t->inc_refcount("async_seed_hash");
|
||||
m_disk_thread.async_hash(&t->storage(), r.piece, 0
|
||||
, boost::bind(&peer_connection::on_seed_mode_hashed, self(), _1)
|
||||
, std::bind(&peer_connection::on_seed_mode_hashed, self(), _1)
|
||||
, this);
|
||||
t->verifying(r.piece);
|
||||
continue;
|
||||
|
@ -5225,7 +5226,7 @@ namespace libtorrent
|
|||
|
||||
t->inc_refcount("async_read");
|
||||
m_disk_thread.async_read(&t->storage(), r
|
||||
, boost::bind(&peer_connection::on_disk_read_complete
|
||||
, std::bind(&peer_connection::on_disk_read_complete
|
||||
, self(), _1, r, clock_type::now()), this);
|
||||
}
|
||||
m_last_sent_payload = clock_type::now();
|
||||
|
@ -5661,7 +5662,7 @@ namespace libtorrent
|
|||
m_socket_is_writing = true;
|
||||
#endif
|
||||
|
||||
m_socket->async_write_some(vec, make_write_handler(boost::bind(
|
||||
m_socket->async_write_some(vec, make_write_handler(std::bind(
|
||||
&peer_connection::on_send_data, self(), _1, _2)));
|
||||
|
||||
m_channel_state[upload_channel] |= peer_info::bw_network;
|
||||
|
@ -5762,7 +5763,7 @@ namespace libtorrent
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("peer_connection::on_receive_data_nb");
|
||||
m_socket->async_read_some(null_buffers(), make_read_handler(
|
||||
boost::bind(&peer_connection::on_receive_data_nb, self(), _1, _2)));
|
||||
std::bind(&peer_connection::on_receive_data_nb, self(), _1, _2)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -5796,7 +5797,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(boost::asio::buffer_size(vec[0]) > 0);
|
||||
m_socket->async_read_some(
|
||||
boost::asio::mutable_buffers_1(vec[0]), make_read_handler(
|
||||
boost::bind(&peer_connection::on_receive_data, self(), _1, _2)));
|
||||
std::bind(&peer_connection::on_receive_data, self(), _1, _2)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5804,7 +5805,7 @@ namespace libtorrent
|
|||
+ boost::asio::buffer_size(vec[1])> 0);
|
||||
m_socket->async_read_some(
|
||||
vec, make_read_handler(
|
||||
boost::bind(&peer_connection::on_receive_data, self(), _1, _2)));
|
||||
std::bind(&peer_connection::on_receive_data, self(), _1, _2)));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -6572,9 +6573,9 @@ namespace libtorrent
|
|||
|
||||
std::set<piece_block> unique;
|
||||
std::transform(m_download_queue.begin(), m_download_queue.end()
|
||||
, std::inserter(unique, unique.begin()), boost::bind(&pending_block::block, _1));
|
||||
, std::inserter(unique, unique.begin()), std::bind(&pending_block::block, _1));
|
||||
std::transform(m_request_queue.begin(), m_request_queue.end()
|
||||
, std::inserter(unique, unique.begin()), boost::bind(&pending_block::block, _1));
|
||||
, std::inserter(unique, unique.begin()), std::bind(&pending_block::block, _1));
|
||||
TORRENT_ASSERT(unique.size() == m_download_queue.size() + m_request_queue.size());
|
||||
if (m_peer_info)
|
||||
{
|
||||
|
|
|
@ -32,11 +32,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/web_peer_connection.hpp"
|
||||
#include "libtorrent/peer_list.hpp"
|
||||
|
@ -66,6 +67,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/ip_voter.hpp" // for external_ip
|
||||
#endif
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
@ -549,7 +552,7 @@ namespace libtorrent
|
|||
|
||||
// insert this candidate sorted into peers
|
||||
std::vector<torrent_peer*>::iterator i = std::lower_bound(peers.begin(), peers.end()
|
||||
, &pe, boost::bind(&peer_list::compare_peer, this, _1, _2, boost::cref(external), external_port));
|
||||
, &pe, std::bind(&peer_list::compare_peer, this, _1, _2, boost::cref(external), external_port));
|
||||
|
||||
peers.insert(i, &pe);
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
*/
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <limits>
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
@ -65,6 +65,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
// this is really only useful for debugging unit tests
|
||||
//#define TORRENT_PICKER_LOG
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -2015,7 +2017,7 @@ namespace libtorrent
|
|||
// picked from it we're done. Sorting the rest of the list in that
|
||||
// case is a waste of time.
|
||||
std::sort(ordered_partials, ordered_partials + num_ordered_partials
|
||||
, boost::bind(&piece_picker::partial_compare_rarest_first, this
|
||||
, std::bind(&piece_picker::partial_compare_rarest_first, this
|
||||
, _1, _2));
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
|
|
@ -31,10 +31,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include "libtorrent/resolver.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
#include "libtorrent/debug.hpp"
|
||||
#include "libtorrent/aux_/time.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
resolver::resolver(io_service& ios)
|
||||
|
@ -96,7 +99,7 @@ namespace libtorrent
|
|||
|| i->second.last_seen + m_timeout >= aux::time_now())
|
||||
{
|
||||
error_code ec;
|
||||
m_ios.post(boost::bind(h, ec, i->second.addresses));
|
||||
m_ios.post(std::bind(h, ec, i->second.addresses));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +112,7 @@ namespace libtorrent
|
|||
{
|
||||
std::vector<address> addresses;
|
||||
addresses.push_back(ip);
|
||||
m_ios.post(boost::bind(h, ec, addresses));
|
||||
m_ios.post(std::bind(h, ec, addresses));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -119,12 +122,12 @@ namespace libtorrent
|
|||
ADD_OUTSTANDING_ASYNC("resolver::on_lookup");
|
||||
if (flags & resolver_interface::abort_on_shutdown)
|
||||
{
|
||||
m_resolver.async_resolve(q, boost::bind(&resolver::on_lookup, this, _1, _2
|
||||
m_resolver.async_resolve(q, std::bind(&resolver::on_lookup, this, _1, _2
|
||||
, h, host));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_critical_resolver.async_resolve(q, boost::bind(&resolver::on_lookup, this, _1, _2
|
||||
m_critical_resolver.async_resolve(q, std::bind(&resolver::on_lookup, this, _1, _2
|
||||
, h, host));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
@ -42,15 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#ifdef TORRENT_PROFILE_CALLS
|
||||
#include <boost/unordered_map.hpp>
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/extensions/ut_pex.hpp"
|
||||
#include "libtorrent/extensions/ut_metadata.hpp"
|
||||
|
@ -72,12 +62,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/ip_filter.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
#include "libtorrent/aux_/session_call.hpp"
|
||||
#include "libtorrent/kademlia/dht_tracker.hpp"
|
||||
#include "libtorrent/natpmp.hpp"
|
||||
#include "libtorrent/upnp.hpp"
|
||||
#include "libtorrent/magnet_uri.hpp"
|
||||
#include "libtorrent/lazy_entry.hpp"
|
||||
#include "libtorrent/aux_/session_call.hpp"
|
||||
|
||||
using boost::shared_ptr;
|
||||
using boost::weak_ptr;
|
||||
|
@ -316,9 +306,6 @@ namespace libtorrent
|
|||
}
|
||||
#endif
|
||||
|
||||
#define TORRENT_ASYNC_CALL(x) \
|
||||
m_impl->get_io_service().dispatch(boost::bind(&session_impl:: x, m_impl.get()))
|
||||
|
||||
#ifndef TORRENT_CFG
|
||||
#error TORRENT_CFG is not defined!
|
||||
#endif
|
||||
|
@ -369,7 +356,11 @@ namespace libtorrent
|
|||
aux::dump_call_profile();
|
||||
|
||||
TORRENT_ASSERT(m_impl);
|
||||
TORRENT_ASYNC_CALL(abort);
|
||||
boost::shared_ptr<session_impl> ptr = m_impl;
|
||||
|
||||
// capture the shared_ptr in the dispatched function
|
||||
// to keep the session_impl alive
|
||||
m_impl->get_io_service().dispatch([=]() { ptr->abort(); });
|
||||
|
||||
#if defined TORRENT_ASIO_DEBUGGING
|
||||
int counter = 0;
|
||||
|
|
|
@ -36,8 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/lazy_entry.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
#include "libtorrent/read_resume_data.hpp"
|
||||
#endif
|
||||
|
|
|
@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <algorithm>
|
||||
#include <cstdio> // for snprintf
|
||||
#include <cinttypes> // for PRId64 et.al.
|
||||
#include <functional>
|
||||
|
||||
#if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
|
||||
#include <unordered_set>
|
||||
|
@ -46,7 +47,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/function_equal.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/asio/ip/v6_only.hpp>
|
||||
|
@ -184,6 +184,7 @@ namespace
|
|||
using boost::shared_ptr;
|
||||
using boost::weak_ptr;
|
||||
using libtorrent::aux::session_impl;
|
||||
using namespace std::placeholders;
|
||||
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
namespace boost {
|
||||
|
@ -337,8 +338,8 @@ namespace aux {
|
|||
, m_tcp_peer_class(0)
|
||||
, m_local_peer_class(0)
|
||||
, m_tracker_manager(
|
||||
boost::bind(&session_impl::send_udp_packet, this, false, _1, _2, _3, _4)
|
||||
, boost::bind(&session_impl::send_udp_packet_hostname, this, _1, _2, _3, _4, _5)
|
||||
std::bind(&session_impl::send_udp_packet, this, false, _1, _2, _3, _4)
|
||||
, std::bind(&session_impl::send_udp_packet_hostname, this, _1, _2, _3, _4, _5)
|
||||
, m_stats_counters
|
||||
, m_host_resolver
|
||||
, m_settings
|
||||
|
@ -376,14 +377,14 @@ namespace aux {
|
|||
, m_outstanding_router_lookups(0)
|
||||
#endif
|
||||
, m_utp_socket_manager(
|
||||
boost::bind(&session_impl::send_udp_packet, this, false, _1, _2, _3, _4)
|
||||
, boost::bind(&session_impl::incoming_connection, this, _1)
|
||||
std::bind(&session_impl::send_udp_packet, this, false, _1, _2, _3, _4)
|
||||
, std::bind(&session_impl::incoming_connection, this, _1)
|
||||
, m_io_service
|
||||
, m_settings, m_stats_counters, NULL)
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
, m_ssl_utp_socket_manager(
|
||||
boost::bind(&session_impl::send_udp_packet, this, true, _1, _2, _3, _4)
|
||||
, boost::bind(&session_impl::on_incoming_utp_ssl, this, _1)
|
||||
std::bind(&session_impl::send_udp_packet, this, true, _1, _2, _3, _4)
|
||||
, std::bind(&session_impl::on_incoming_utp_ssl, this, _1)
|
||||
, m_io_service
|
||||
, m_settings, m_stats_counters
|
||||
, &m_ssl_ctx)
|
||||
|
@ -494,7 +495,7 @@ namespace aux {
|
|||
#endif
|
||||
|
||||
boost::shared_ptr<settings_pack> copy = boost::make_shared<settings_pack>(pack);
|
||||
m_io_service.post(boost::bind(&session_impl::init, this, copy));
|
||||
m_io_service.post(std::bind(&session_impl::init, this, copy));
|
||||
}
|
||||
|
||||
void session_impl::init(boost::shared_ptr<settings_pack> pack)
|
||||
|
@ -515,8 +516,8 @@ namespace aux {
|
|||
std::string stats_header = "session stats header: ";
|
||||
std::vector<stats_metric> stats = session_stats_metrics();
|
||||
std::sort(stats.begin(), stats.end()
|
||||
, boost::bind(&stats_metric::value_index, _1)
|
||||
< boost::bind(&stats_metric::value_index, _2));
|
||||
, [] (stats_metric const& lhs, stats_metric const& rhs)
|
||||
{ return lhs.value_index < rhs.value_index; });
|
||||
for (int i = 0; i < stats.size(); ++i)
|
||||
{
|
||||
if (i > 0) stats_header += ", ";
|
||||
|
@ -535,14 +536,14 @@ namespace aux {
|
|||
add_outstanding_async("session_impl::on_tick");
|
||||
#endif
|
||||
error_code ec;
|
||||
m_io_service.post(boost::bind(&session_impl::on_tick, this, ec));
|
||||
m_io_service.post(std::bind(&session_impl::on_tick, this, ec));
|
||||
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::on_lsd_announce");
|
||||
int delay = (std::max)(m_settings.get_int(settings_pack::local_service_announce_interval)
|
||||
/ (std::max)(int(m_torrents.size()), 1), 1);
|
||||
m_lsd_announce_timer.expires_from_now(seconds(delay), ec);
|
||||
m_lsd_announce_timer.async_wait(
|
||||
boost::bind(&session_impl::on_lsd_announce, this, _1));
|
||||
std::bind(&session_impl::on_lsd_announce, this, _1));
|
||||
TORRENT_ASSERT(!ec);
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
@ -981,7 +982,7 @@ namespace aux {
|
|||
// shutdown_stage2 from there.
|
||||
if (m_undead_peers.empty())
|
||||
{
|
||||
m_io_service.post(boost::bind(&session_impl::abort_stage2, this));
|
||||
m_io_service.post(std::bind(&session_impl::abort_stage2, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1392,7 +1393,7 @@ namespace aux {
|
|||
{
|
||||
if (m_deferred_submit_disk_jobs) return;
|
||||
m_deferred_submit_disk_jobs = true;
|
||||
m_io_service.post(boost::bind(&session_impl::submit_disk_jobs, this));
|
||||
m_io_service.post(std::bind(&session_impl::submit_disk_jobs, this));
|
||||
}
|
||||
|
||||
void session_impl::submit_disk_jobs()
|
||||
|
@ -1815,7 +1816,7 @@ namespace aux {
|
|||
|
||||
// TODO: 2 use a handler allocator here
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::on_udp_packet");
|
||||
ret.udp_sock->async_read(boost::bind(&session_impl::on_udp_packet
|
||||
ret.udp_sock->async_read(std::bind(&session_impl::on_udp_packet
|
||||
, this, boost::weak_ptr<udp_socket>(ret.udp_sock), ret.ssl, _1));
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
|
@ -2047,7 +2048,7 @@ namespace aux {
|
|||
m_socks_listen_port = listen_port();
|
||||
if (m_socks_listen_port == 0) m_socks_listen_port = 2000 + random() % 60000;
|
||||
s.async_listen(tcp::endpoint(address_v4::any(), m_socks_listen_port)
|
||||
, boost::bind(&session_impl::on_socks_listen, this
|
||||
, std::bind(&session_impl::on_socks_listen, this
|
||||
, m_socks_listen_socket, _1));
|
||||
}
|
||||
|
||||
|
@ -2084,7 +2085,7 @@ namespace aux {
|
|||
add_outstanding_async("session_impl::on_socks_accept");
|
||||
#endif
|
||||
socks5_stream& s = *m_socks_listen_socket->get<socks5_stream>();
|
||||
s.async_accept(boost::bind(&session_impl::on_socks_accept, this
|
||||
s.async_accept(std::bind(&session_impl::on_socks_accept, this
|
||||
, m_socks_listen_socket, _1));
|
||||
}
|
||||
|
||||
|
@ -2122,7 +2123,7 @@ namespace aux {
|
|||
}
|
||||
m_i2p_conn.open(m_settings.get_str(settings_pack::i2p_hostname)
|
||||
, m_settings.get_int(settings_pack::i2p_port)
|
||||
, boost::bind(&session_impl::on_i2p_open, this, _1));
|
||||
, std::bind(&session_impl::on_i2p_open, this, _1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2174,7 +2175,7 @@ namespace aux {
|
|||
s.set_session_id(m_i2p_conn.session_id());
|
||||
|
||||
s.async_connect(tcp::endpoint()
|
||||
, boost::bind(&session_impl::on_i2p_accept, this, m_i2p_listen_socket, _1));
|
||||
, std::bind(&session_impl::on_i2p_accept, this, m_i2p_listen_socket, _1));
|
||||
}
|
||||
|
||||
void session_impl::on_i2p_accept(boost::shared_ptr<socket_type> const& s
|
||||
|
@ -2225,7 +2226,7 @@ namespace aux {
|
|||
{
|
||||
i->udp_write_blocked = true;
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::on_udp_writeable");
|
||||
i->udp_sock->async_write(boost::bind(&session_impl::on_udp_writeable
|
||||
i->udp_sock->async_write(std::bind(&session_impl::on_udp_writeable
|
||||
, this, boost::weak_ptr<udp_socket>(i->udp_sock), _1));
|
||||
}
|
||||
return;
|
||||
|
@ -2258,7 +2259,7 @@ namespace aux {
|
|||
{
|
||||
i->udp_write_blocked = true;
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::on_udp_writeable");
|
||||
i->udp_sock->async_write(boost::bind(&session_impl::on_udp_writeable
|
||||
i->udp_sock->async_write(std::bind(&session_impl::on_udp_writeable
|
||||
, this, boost::weak_ptr<udp_socket>(i->udp_sock), _1));
|
||||
}
|
||||
return;
|
||||
|
@ -2276,7 +2277,7 @@ namespace aux {
|
|||
|
||||
std::list<listen_socket_t>::iterator i = std::find_if(
|
||||
m_listen_sockets.begin(), m_listen_sockets.end()
|
||||
, boost::bind(&listen_socket_t::udp_sock, _1) == sock);
|
||||
, [&sock] (listen_socket_t const& ls) { return ls.udp_sock == sock; });
|
||||
|
||||
if (i == m_listen_sockets.end()) return;
|
||||
|
||||
|
@ -2431,7 +2432,7 @@ namespace aux {
|
|||
mgr.socket_drained();
|
||||
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::on_udp_packet");
|
||||
s->async_read(boost::bind(&session_impl::on_udp_packet
|
||||
s->async_read(std::bind(&session_impl::on_udp_packet
|
||||
, this, socket, ssl, _1));
|
||||
}
|
||||
|
||||
|
@ -2465,7 +2466,7 @@ namespace aux {
|
|||
#endif
|
||||
|
||||
listener->async_accept(*str
|
||||
, boost::bind(&session_impl::on_accept_connection, this, c
|
||||
, std::bind(&session_impl::on_accept_connection, this, c
|
||||
, boost::weak_ptr<tcp::acceptor>(listener), _1, ssl));
|
||||
}
|
||||
|
||||
|
@ -2518,13 +2519,9 @@ namespace aux {
|
|||
if (m_settings.get_int(settings_pack::connections_limit) > 10)
|
||||
{
|
||||
// now, disconnect a random peer
|
||||
torrent_map::iterator i = std::max_element(m_torrents.begin()
|
||||
, m_torrents.end()
|
||||
, boost::bind(&torrent::num_peers
|
||||
, boost::bind(&torrent_map::value_type::second, _1))
|
||||
< boost::bind(&torrent::num_peers
|
||||
, boost::bind(&torrent_map::value_type::second, _2))
|
||||
);
|
||||
torrent_map::iterator i = std::max_element(m_torrents.begin(), m_torrents.end()
|
||||
, [](torrent_map::value_type const& lhs, torrent_map::value_type const& rhs)
|
||||
{ return lhs.second->num_peers() < rhs.second->num_peers(); });
|
||||
|
||||
if (m_alerts.should_post<performance_alert>())
|
||||
m_alerts.emplace_alert<performance_alert>(
|
||||
|
@ -2560,7 +2557,7 @@ namespace aux {
|
|||
// after the handshake is done
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");
|
||||
s->get<ssl_stream<tcp::socket> >()->async_accept_handshake(
|
||||
boost::bind(&session_impl::ssl_handshake, this, _1, s));
|
||||
std::bind(&session_impl::ssl_handshake, this, _1, s));
|
||||
m_incoming_sockets.insert(s);
|
||||
}
|
||||
else
|
||||
|
@ -2580,7 +2577,7 @@ namespace aux {
|
|||
// after the handshake is done
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::ssl_handshake");
|
||||
s->get<ssl_stream<utp_stream> >()->async_accept_handshake(
|
||||
boost::bind(&session_impl::ssl_handshake, this, _1, s));
|
||||
std::bind(&session_impl::ssl_handshake, this, _1, s));
|
||||
m_incoming_sockets.insert(s);
|
||||
}
|
||||
|
||||
|
@ -2979,16 +2976,15 @@ namespace aux {
|
|||
bool session_impl::has_peer(peer_connection const* p) const
|
||||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
return std::find_if(m_connections.begin(), m_connections.end()
|
||||
, boost::bind(&boost::shared_ptr<peer_connection>::get, _1) == p)
|
||||
!= m_connections.end();
|
||||
return std::any_of(m_connections.begin(), m_connections.end()
|
||||
, [p] (boost::shared_ptr<peer_connection> const& pr)
|
||||
{ return pr.get() == p; });
|
||||
}
|
||||
|
||||
bool session_impl::any_torrent_has_peer(peer_connection const* p) const
|
||||
{
|
||||
for (aux::session_impl::torrent_map::const_iterator i = m_torrents.begin()
|
||||
, end(m_torrents.end()); i != end; ++i)
|
||||
if (i->second->has_peer(p)) return true;
|
||||
for (auto& pe : m_torrents)
|
||||
if (pe.second->has_peer(p)) return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -3046,7 +3042,7 @@ namespace aux {
|
|||
{
|
||||
std::vector<boost::shared_ptr<peer_connection> >::iterator remove_it
|
||||
= std::remove_if(m_undead_peers.begin(), m_undead_peers.end()
|
||||
, boost::bind(&boost::shared_ptr<peer_connection>::unique, _1));
|
||||
, std::bind(&boost::shared_ptr<peer_connection>::unique, _1));
|
||||
m_undead_peers.erase(remove_it, m_undead_peers.end());
|
||||
if (m_undead_peers.empty())
|
||||
{
|
||||
|
@ -3055,7 +3051,7 @@ namespace aux {
|
|||
// shut-down
|
||||
if (m_abort)
|
||||
{
|
||||
m_io_service.post(boost::bind(&session_impl::abort_stage2, this));
|
||||
m_io_service.post(std::bind(&session_impl::abort_stage2, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3100,7 +3096,7 @@ namespace aux {
|
|||
ADD_OUTSTANDING_ASYNC("session_impl::on_tick");
|
||||
error_code ec;
|
||||
m_timer.expires_at(now + milliseconds(m_settings.get_int(settings_pack::tick_interval)), ec);
|
||||
m_timer.async_wait(make_tick_handler(boost::bind(&session_impl::on_tick, this, _1)));
|
||||
m_timer.async_wait(make_tick_handler(std::bind(&session_impl::on_tick, this, _1)));
|
||||
|
||||
m_download_rate.update_quotas(now - m_last_tick);
|
||||
m_upload_rate.update_quotas(now - m_last_tick);
|
||||
|
@ -3398,8 +3394,8 @@ namespace aux {
|
|||
// every 90 seconds, disconnect the worst peers
|
||||
// if we have reached the connection limit
|
||||
torrent_map::iterator i = std::max_element(m_torrents.begin(), m_torrents.end()
|
||||
, boost::bind(&torrent::num_peers, boost::bind(&torrent_map::value_type::second, _1))
|
||||
< boost::bind(&torrent::num_peers, boost::bind(&torrent_map::value_type::second, _2)));
|
||||
, [] (torrent_map::value_type const& lhs, torrent_map::value_type const& rhs)
|
||||
{ return lhs.second->num_peers() < rhs.second->num_peers(); });
|
||||
|
||||
TORRENT_ASSERT(i != m_torrents.end());
|
||||
int peers_to_disconnect = (std::min)((std::max)(
|
||||
|
@ -3514,7 +3510,7 @@ namespace aux {
|
|||
error_code ec;
|
||||
m_dht_announce_timer.expires_from_now(seconds(0), ec);
|
||||
m_dht_announce_timer.async_wait(
|
||||
bind(&session_impl::on_dht_announce, this, _1));
|
||||
std::bind(&session_impl::on_dht_announce, this, _1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3563,7 +3559,7 @@ namespace aux {
|
|||
error_code ec;
|
||||
m_dht_announce_timer.expires_from_now(seconds(delay), ec);
|
||||
m_dht_announce_timer.async_wait(
|
||||
bind(&session_impl::on_dht_announce, this, _1));
|
||||
std::bind(&session_impl::on_dht_announce, this, _1));
|
||||
|
||||
if (!m_dht_torrents.empty())
|
||||
{
|
||||
|
@ -3609,7 +3605,7 @@ namespace aux {
|
|||
error_code ec;
|
||||
m_lsd_announce_timer.expires_from_now(seconds(delay), ec);
|
||||
m_lsd_announce_timer.async_wait(
|
||||
bind(&session_impl::on_lsd_announce, this, _1));
|
||||
std::bind(&session_impl::on_lsd_announce, this, _1));
|
||||
|
||||
if (m_torrents.empty()) return;
|
||||
|
||||
|
@ -3752,16 +3748,18 @@ namespace aux {
|
|||
// relevant
|
||||
std::partial_sort(checking.begin(), checking.begin() +
|
||||
(std::min)(checking_limit, int(checking.size())), checking.end()
|
||||
, boost::bind(&torrent::sequence_number, _1) < boost::bind(&torrent::sequence_number, _2));
|
||||
, [](torrent const* lhs, torrent const* rhs)
|
||||
{ return lhs->sequence_number() < rhs->sequence_number(); });
|
||||
|
||||
std::partial_sort(downloaders.begin(), downloaders.begin() +
|
||||
(std::min)(hard_limit, int(downloaders.size())), downloaders.end()
|
||||
, boost::bind(&torrent::sequence_number, _1) < boost::bind(&torrent::sequence_number, _2));
|
||||
, [](torrent const* lhs, torrent const* rhs)
|
||||
{ return lhs->sequence_number() < rhs->sequence_number(); });
|
||||
|
||||
std::partial_sort(seeds.begin(), seeds.begin() +
|
||||
(std::min)(hard_limit, int(seeds.size())), seeds.end()
|
||||
, boost::bind(&torrent::seed_rank, _1, boost::ref(m_settings))
|
||||
> boost::bind(&torrent::seed_rank, _2, boost::ref(m_settings)));
|
||||
, [this](torrent const* lhs, torrent const* rhs)
|
||||
{ return lhs->seed_rank(m_settings) > rhs->seed_rank(m_settings); });
|
||||
}
|
||||
|
||||
auto_manage_checking_torrents(checking, checking_limit);
|
||||
|
@ -4628,7 +4626,7 @@ namespace aux {
|
|||
if (string_begins_no_case("file://", params->url.c_str()) && !params->ti)
|
||||
{
|
||||
m_disk_thread.async_load_torrent(params
|
||||
, boost::bind(&session_impl::on_async_load_torrent, this, _1));
|
||||
, std::bind(&session_impl::on_async_load_torrent, this, _1));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4883,9 +4881,9 @@ namespace aux {
|
|||
// if we still can't find the torrent, look for it by url
|
||||
if (!torrent_ptr && !params.url.empty())
|
||||
{
|
||||
torrent_map::iterator i = std::find_if(m_torrents.begin()
|
||||
, m_torrents.end(), boost::bind(&torrent::url, boost::bind(&std::pair<const sha1_hash
|
||||
, boost::shared_ptr<torrent> >::second, _1)) == params.url);
|
||||
torrent_map::iterator i = std::find_if(m_torrents.begin(), m_torrents.end()
|
||||
, [¶ms](torrent_map::value_type const& te)
|
||||
{ return te.second->url() == params.url; });
|
||||
if (i != m_torrents.end())
|
||||
torrent_ptr = i->second;
|
||||
}
|
||||
|
@ -5141,7 +5139,7 @@ namespace aux {
|
|||
// these are the current interfaces we have, first remove all the SSL
|
||||
// interfaces
|
||||
current_ifaces.erase(std::remove_if(current_ifaces.begin(), current_ifaces.end()
|
||||
, boost::bind(&listen_interface_t::ssl, _1)), current_ifaces.end());
|
||||
, std::bind(&listen_interface_t::ssl, _1)), current_ifaces.end());
|
||||
|
||||
int const ssl_listen_port = m_settings.get_int(settings_pack::ssl_listen);
|
||||
|
||||
|
@ -5412,13 +5410,13 @@ namespace aux {
|
|||
|
||||
std::list<listen_socket_t>::iterator ls
|
||||
= std::find_if(m_listen_sockets.begin(), m_listen_sockets.end()
|
||||
, boost::bind(find_tcp_port_mapping, map_transport, mapping, _1));
|
||||
, std::bind(find_tcp_port_mapping, map_transport, mapping, _1));
|
||||
|
||||
bool tcp = true;
|
||||
if (ls == m_listen_sockets.end())
|
||||
{
|
||||
ls = std::find_if(m_listen_sockets.begin(), m_listen_sockets.end()
|
||||
, boost::bind(find_udp_port_mapping, map_transport, mapping, _1));
|
||||
, std::bind(find_udp_port_mapping, map_transport, mapping, _1));
|
||||
tcp = false;
|
||||
}
|
||||
|
||||
|
@ -5597,7 +5595,7 @@ namespace aux {
|
|||
m_dht = boost::make_shared<dht::dht_tracker>(
|
||||
static_cast<dht_observer*>(this)
|
||||
, boost::ref(m_io_service)
|
||||
, boost::bind(&session_impl::send_udp_packet, this, false, _1, _2, _3, _4)
|
||||
, std::bind(&session_impl::send_udp_packet, this, false, _1, _2, _3, _4)
|
||||
, boost::cref(m_dht_settings)
|
||||
, boost::ref(m_stats_counters)
|
||||
, m_dht_storage_constructor
|
||||
|
@ -5616,7 +5614,7 @@ namespace aux {
|
|||
}
|
||||
m_dht_nodes.clear();
|
||||
|
||||
m_dht->start(startup_state, boost::bind(&on_bootstrap, boost::ref(m_alerts)));
|
||||
m_dht->start(startup_state, std::bind(&on_bootstrap, boost::ref(m_alerts)));
|
||||
}
|
||||
|
||||
void session_impl::stop_dht()
|
||||
|
@ -5654,7 +5652,7 @@ namespace aux {
|
|||
{
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::on_dht_name_lookup");
|
||||
m_host_resolver.async_resolve(node.first, resolver_interface::abort_on_shutdown
|
||||
, boost::bind(&session_impl::on_dht_name_lookup
|
||||
, std::bind(&session_impl::on_dht_name_lookup
|
||||
, this, _1, _2, node.second));
|
||||
}
|
||||
|
||||
|
@ -5684,7 +5682,7 @@ namespace aux {
|
|||
ADD_OUTSTANDING_ASYNC("session_impl::on_dht_router_name_lookup");
|
||||
++m_outstanding_router_lookups;
|
||||
m_host_resolver.async_resolve(node.first, resolver_interface::abort_on_shutdown
|
||||
, boost::bind(&session_impl::on_dht_router_name_lookup
|
||||
, std::bind(&session_impl::on_dht_router_name_lookup
|
||||
, this, _1, _2, node.second));
|
||||
}
|
||||
|
||||
|
@ -5728,7 +5726,7 @@ namespace aux {
|
|||
void session_impl::dht_get_immutable_item(sha1_hash const& target)
|
||||
{
|
||||
if (!m_dht) return;
|
||||
m_dht->get_item(target, boost::bind(&session_impl::get_immutable_callback
|
||||
m_dht->get_item(target, std::bind(&session_impl::get_immutable_callback
|
||||
, this, target, _1));
|
||||
}
|
||||
|
||||
|
@ -5746,7 +5744,7 @@ namespace aux {
|
|||
, std::string salt)
|
||||
{
|
||||
if (!m_dht) return;
|
||||
m_dht->get_item(key.data(), boost::bind(&session_impl::get_mutable_callback
|
||||
m_dht->get_item(key.data(), std::bind(&session_impl::get_mutable_callback
|
||||
, this, _1, _2), salt);
|
||||
}
|
||||
|
||||
|
@ -5801,7 +5799,7 @@ namespace aux {
|
|||
void session_impl::dht_put_immutable_item(entry const& data, sha1_hash target)
|
||||
{
|
||||
if (!m_dht) return;
|
||||
m_dht->put_item(data, boost::bind(&on_dht_put_immutable_item, boost::ref(m_alerts)
|
||||
m_dht->put_item(data, std::bind(&on_dht_put_immutable_item, boost::ref(m_alerts)
|
||||
, target, _1));
|
||||
}
|
||||
|
||||
|
@ -5812,26 +5810,26 @@ namespace aux {
|
|||
{
|
||||
if (!m_dht) return;
|
||||
m_dht->put_item(key.data(),
|
||||
boost::bind(&on_dht_put_mutable_item, boost::ref(m_alerts), _1, _2),
|
||||
boost::bind(&put_mutable_callback, _1, cb), salt);
|
||||
std::bind(&on_dht_put_mutable_item, boost::ref(m_alerts), _1, _2),
|
||||
std::bind(&put_mutable_callback, _1, cb), salt);
|
||||
}
|
||||
|
||||
void session_impl::dht_get_peers(sha1_hash const& info_hash)
|
||||
{
|
||||
if (!m_dht) return;
|
||||
m_dht->get_peers(info_hash, boost::bind(&on_dht_get_peers, boost::ref(m_alerts), info_hash, _1));
|
||||
m_dht->get_peers(info_hash, std::bind(&on_dht_get_peers, boost::ref(m_alerts), info_hash, _1));
|
||||
}
|
||||
|
||||
void session_impl::dht_announce(sha1_hash const& info_hash, int port, int flags)
|
||||
{
|
||||
if (!m_dht) return;
|
||||
m_dht->announce(info_hash, port, flags, boost::bind(&on_dht_get_peers, boost::ref(m_alerts), info_hash, _1));
|
||||
m_dht->announce(info_hash, port, flags, std::bind(&on_dht_get_peers, boost::ref(m_alerts), info_hash, _1));
|
||||
}
|
||||
|
||||
void session_impl::dht_direct_request(udp::endpoint ep, entry& e, void* userdata)
|
||||
{
|
||||
if (!m_dht) return;
|
||||
m_dht->direct_request(ep, e, boost::bind(&on_direct_response, boost::ref(m_alerts), userdata, _1));
|
||||
m_dht->direct_request(ep, e, std::bind(&on_direct_response, boost::ref(m_alerts), userdata, _1));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -6137,7 +6135,7 @@ namespace aux {
|
|||
m_pending_auto_manage = true;
|
||||
m_need_auto_manage = true;
|
||||
|
||||
m_io_service.post(boost::bind(&session_impl::on_trigger_auto_manage, this));
|
||||
m_io_service.post(std::bind(&session_impl::on_trigger_auto_manage, this));
|
||||
}
|
||||
|
||||
void session_impl::on_trigger_auto_manage()
|
||||
|
@ -6212,7 +6210,7 @@ namespace aux {
|
|||
/ (std::max)(int(m_torrents.size()), 1), 1);
|
||||
m_dht_announce_timer.expires_from_now(seconds(delay), ec);
|
||||
m_dht_announce_timer.async_wait(
|
||||
boost::bind(&session_impl::on_dht_announce, this, _1));
|
||||
std::bind(&session_impl::on_dht_announce, this, _1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -6454,9 +6452,9 @@ namespace aux {
|
|||
if (m_lsd) return;
|
||||
|
||||
m_lsd = boost::make_shared<lsd>(boost::ref(m_io_service)
|
||||
, boost::bind(&session_impl::on_lsd_peer, this, _1, _2)
|
||||
, std::bind(&session_impl::on_lsd_peer, this, _1, _2)
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
, boost::bind(&session_impl::on_lsd_log, this, _1)
|
||||
, std::bind(&session_impl::on_lsd_log, this, _1)
|
||||
#endif
|
||||
);
|
||||
error_code ec;
|
||||
|
@ -6482,9 +6480,9 @@ namespace aux {
|
|||
// the natpmp constructor may fail and call the callbacks
|
||||
// into the session_impl.
|
||||
m_natpmp = boost::make_shared<natpmp>(boost::ref(m_io_service)
|
||||
, boost::bind(&session_impl::on_port_mapping
|
||||
, std::bind(&session_impl::on_port_mapping
|
||||
, this, _1, _2, _3, _4, _5, 0)
|
||||
, boost::bind(&session_impl::on_port_map_log
|
||||
, std::bind(&session_impl::on_port_map_log
|
||||
, this, _1, 0));
|
||||
m_natpmp->start();
|
||||
|
||||
|
@ -6505,9 +6503,9 @@ namespace aux {
|
|||
// the upnp constructor may fail and call the callbacks
|
||||
m_upnp = boost::make_shared<upnp>(boost::ref(m_io_service)
|
||||
, m_settings.get_str(settings_pack::user_agent)
|
||||
, boost::bind(&session_impl::on_port_mapping
|
||||
, std::bind(&session_impl::on_port_mapping
|
||||
, this, _1, _2, _3, _4, _5, 1)
|
||||
, boost::bind(&session_impl::on_port_map_log
|
||||
, std::bind(&session_impl::on_port_map_log
|
||||
, this, _1, 1)
|
||||
, m_settings.get_bool(settings_pack::upnp_ignore_nonrouters));
|
||||
m_upnp->start();
|
||||
|
|
|
@ -33,7 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/session_stats.hpp" // for stats_metric
|
||||
#include "libtorrent/aux_/session_interface.hpp" // for stats counter names
|
||||
#include "libtorrent/performance_counters.hpp" // for counters
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -551,10 +550,11 @@ namespace libtorrent
|
|||
|
||||
int find_metric_idx(char const* name)
|
||||
{
|
||||
stats_metric_impl const* end = metrics + sizeof(metrics)/sizeof(metrics[0]);
|
||||
stats_metric_impl const* i = std::find_if(metrics, end , boost::bind(&strcmp
|
||||
, boost::bind(&stats_metric_impl::name, _1), name) == 0);
|
||||
if (i == end) return -1;
|
||||
stats_metric_impl const* i = std::find_if(std::begin(metrics), std::end(metrics)
|
||||
, [name](stats_metric_impl const& metr)
|
||||
{ return std::strcmp(metr.name, name) == 0; });
|
||||
|
||||
if (i == std::end(metrics)) return -1;
|
||||
return i->value_index;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <utility>
|
||||
#include <numeric>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/torrent.hpp"
|
||||
|
@ -62,6 +63,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/hex.hpp" // to_hex, from_hex
|
||||
#endif
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
class torrent;
|
||||
|
@ -98,7 +101,7 @@ namespace
|
|||
if (i->first.block_index == pb.block_index)
|
||||
{
|
||||
m_torrent.session().disk_thread().async_read(&m_torrent.storage()
|
||||
, r, boost::bind(&smart_ban_plugin::on_read_ok_block
|
||||
, r, std::bind(&smart_ban_plugin::on_read_ok_block
|
||||
, shared_from_this(), *i, i->second.peer->address(), _1)
|
||||
, reinterpret_cast<void*>(1));
|
||||
m_block_hashes.erase(i++);
|
||||
|
@ -155,7 +158,7 @@ namespace
|
|||
// downloaded one very soon, and to get a block by reference would fail, since the
|
||||
// block read will have been deleted by the time it gets back to the network thread
|
||||
m_torrent.session().disk_thread().async_read(&m_torrent.storage(), r
|
||||
, boost::bind(&smart_ban_plugin::on_read_failed_block
|
||||
, std::bind(&smart_ban_plugin::on_read_failed_block
|
||||
, shared_from_this(), pb, (*i)->address(), _1)
|
||||
, reinterpret_cast<torrent_peer*>(1)
|
||||
, disk_io_job::force_copy);
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace libtorrent
|
|||
|
||||
#define CASE(t) case socket_type_int_impl<ssl_stream<t> >::value: \
|
||||
MAYBE_ASIO_DEBUGGING \
|
||||
s.get<ssl_stream<t> >()->async_shutdown(boost::bind(&on_close_socket, &s, holder)); \
|
||||
s.get<ssl_stream<t> >()->async_shutdown(std::bind(&on_close_socket, &s, holder)); \
|
||||
break;
|
||||
|
||||
switch (s.type())
|
||||
|
|
|
@ -34,6 +34,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -145,7 +149,7 @@ namespace libtorrent
|
|||
// TOOD: we could bind the socket here, since we know what the
|
||||
// target endpoint is of the proxy
|
||||
ADD_OUTSTANDING_ASYNC("socks5_stream::connected");
|
||||
m_sock.async_connect(i->endpoint(), boost::bind(
|
||||
m_sock.async_connect(i->endpoint(), std::bind(
|
||||
&socks5_stream::connected, this, _1, h));
|
||||
}
|
||||
|
||||
|
@ -174,7 +178,7 @@ namespace libtorrent
|
|||
}
|
||||
ADD_OUTSTANDING_ASYNC("socks5_stream::handshake1");
|
||||
async_write(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&socks5_stream::handshake1, this, _1, h));
|
||||
, std::bind(&socks5_stream::handshake1, this, _1, h));
|
||||
}
|
||||
else if (m_version == 4)
|
||||
{
|
||||
|
@ -194,7 +198,7 @@ namespace libtorrent
|
|||
ADD_OUTSTANDING_ASYNC("socks5_stream::handshake2");
|
||||
m_buffer.resize(2);
|
||||
async_read(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&socks5_stream::handshake2, this, _1, h));
|
||||
, std::bind(&socks5_stream::handshake2, this, _1, h));
|
||||
}
|
||||
|
||||
void socks5_stream::handshake2(error_code const& e, boost::shared_ptr<handler_type> h)
|
||||
|
@ -239,7 +243,7 @@ namespace libtorrent
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("socks5_stream::handshake3");
|
||||
async_write(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&socks5_stream::handshake3, this, _1, h));
|
||||
, std::bind(&socks5_stream::handshake3, this, _1, h));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -257,7 +261,7 @@ namespace libtorrent
|
|||
ADD_OUTSTANDING_ASYNC("socks5_stream::handshake4");
|
||||
m_buffer.resize(2);
|
||||
async_read(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&socks5_stream::handshake4, this, _1, h));
|
||||
, std::bind(&socks5_stream::handshake4, this, _1, h));
|
||||
}
|
||||
|
||||
void socks5_stream::handshake4(error_code const& e
|
||||
|
@ -347,7 +351,7 @@ namespace libtorrent
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("socks5_stream::connect1");
|
||||
async_write(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&socks5_stream::connect1, this, _1, h));
|
||||
, std::bind(&socks5_stream::connect1, this, _1, h));
|
||||
}
|
||||
|
||||
void socks5_stream::connect1(error_code const& e, boost::shared_ptr<handler_type> h)
|
||||
|
@ -362,7 +366,7 @@ namespace libtorrent
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("socks5_stream::connect2");
|
||||
async_read(m_sock, boost::asio::buffer(m_buffer)
|
||||
, boost::bind(&socks5_stream::connect2, this, _1, h));
|
||||
, std::bind(&socks5_stream::connect2, this, _1, h));
|
||||
}
|
||||
|
||||
void socks5_stream::connect2(error_code const& e, boost::shared_ptr<handler_type> h)
|
||||
|
@ -447,7 +451,7 @@ namespace libtorrent
|
|||
ADD_OUTSTANDING_ASYNC("socks5_stream::connect3");
|
||||
TORRENT_ASSERT(extra_bytes > 0);
|
||||
async_read(m_sock, boost::asio::buffer(&m_buffer[m_buffer.size() - extra_bytes], extra_bytes)
|
||||
, boost::bind(&socks5_stream::connect3, this, _1, h));
|
||||
, std::bind(&socks5_stream::connect3, this, _1, h));
|
||||
}
|
||||
else if (m_version == 4)
|
||||
{
|
||||
|
|
|
@ -41,11 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// for getattrlist()
|
||||
|
@ -81,12 +77,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/alloca.hpp"
|
||||
#include "libtorrent/stat_cache.hpp"
|
||||
#include "libtorrent/hex.hpp" // to_hex, from_hex
|
||||
|
||||
//#define TORRENT_PARTIAL_HASH_LOG
|
||||
|
||||
// for convert_to_wstring and convert_to_native
|
||||
#include "libtorrent/aux_/escape_string.hpp"
|
||||
|
||||
//#define TORRENT_PARTIAL_HASH_LOG
|
||||
|
||||
#define DEBUG_STORAGE 0
|
||||
#define DEBUG_DELETE_FILES 0
|
||||
|
||||
|
|
177
src/torrent.cpp
177
src/torrent.cpp
|
@ -32,8 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <cstdarg> // for va_list
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
|
@ -44,8 +42,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <numeric>
|
||||
#include <limits> // for numeric_limits
|
||||
#include <cstdio> // for snprintf
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#if TORRENT_USE_I2P
|
||||
# include <boost/algorithm/string/predicate.hpp>
|
||||
|
@ -109,9 +109,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
using namespace libtorrent;
|
||||
using boost::tuples::tuple;
|
||||
using boost::tuples::get;
|
||||
using boost::tuples::make_tuple;
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
@ -362,8 +360,9 @@ namespace libtorrent
|
|||
m_trackers.push_back(e);
|
||||
}
|
||||
|
||||
std::sort(m_trackers.begin(), m_trackers.end(), boost::bind(&announce_entry::tier, _1)
|
||||
< boost::bind(&announce_entry::tier, _2));
|
||||
std::sort(m_trackers.begin(), m_trackers.end()
|
||||
, [] (announce_entry const& lhs, announce_entry const& rhs)
|
||||
{ return lhs.tier < rhs.tier; });
|
||||
|
||||
if (settings().get_bool(settings_pack::prefer_udp_trackers))
|
||||
prioritize_udp_trackers();
|
||||
|
@ -520,13 +519,13 @@ namespace libtorrent
|
|||
, end(m_trackers.end()); i != end; ++i)
|
||||
{
|
||||
// if we already have this tracker, ignore it
|
||||
if (std::find_if(new_trackers.begin(), new_trackers.end()
|
||||
, boost::bind(&announce_entry::url, _1) == i->url) != new_trackers.end())
|
||||
if (std::any_of(new_trackers.begin(), new_trackers.end()
|
||||
, [i] (announce_entry const& ae) { return ae.url == i->url; }))
|
||||
continue;
|
||||
|
||||
// insert the tracker ordered by tier
|
||||
new_trackers.insert(std::find_if(new_trackers.begin(), new_trackers.end()
|
||||
, boost::bind(&announce_entry::tier, _1) >= i->tier), *i);
|
||||
, [i] (announce_entry const& ae) { return ae.tier >= i->tier; }), *i);
|
||||
}
|
||||
m_trackers.swap(new_trackers);
|
||||
|
||||
|
@ -768,7 +767,7 @@ namespace libtorrent
|
|||
boost::shared_ptr<http_connection> conn(
|
||||
new http_connection(m_ses.get_io_service()
|
||||
, m_ses.get_resolver()
|
||||
, boost::bind(&torrent::on_torrent_download, shared_from_this()
|
||||
, std::bind(&torrent::on_torrent_download, shared_from_this()
|
||||
, _1, _2, _3, _4)
|
||||
, true // bottled
|
||||
//bottled buffer size
|
||||
|
@ -932,7 +931,7 @@ namespace libtorrent
|
|||
r.length = (std::min)(piece_size - r.start, block_size());
|
||||
inc_refcount("read_piece");
|
||||
m_ses.disk_thread().async_read(&storage(), r
|
||||
, boost::bind(&torrent::on_disk_read_complete
|
||||
, std::bind(&torrent::on_disk_read_complete
|
||||
, shared_from_this(), _1, r, rp), reinterpret_cast<void*>(1));
|
||||
}
|
||||
}
|
||||
|
@ -1100,7 +1099,7 @@ namespace libtorrent
|
|||
// piece are done, and we can restore it, allowing
|
||||
// new requests to it
|
||||
m_ses.disk_thread().async_clear_piece(m_storage.get(), j->piece
|
||||
, boost::bind(&torrent::on_piece_fail_sync, shared_from_this(), _1, block_finished));
|
||||
, std::bind(&torrent::on_piece_fail_sync, shared_from_this(), _1, block_finished));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1313,7 +1312,7 @@ namespace libtorrent
|
|||
}
|
||||
inc_refcount("add_piece");
|
||||
m_ses.disk_thread().async_write(&storage(), p, holder
|
||||
, boost::bind(&torrent::on_disk_write_complete
|
||||
, std::bind(&torrent::on_disk_write_complete
|
||||
, shared_from_this(), _1, p));
|
||||
piece_block block(piece, i);
|
||||
picker().mark_as_downloading(block, 0);
|
||||
|
@ -1603,7 +1602,7 @@ namespace libtorrent
|
|||
// the verification function verifies the distinguished name
|
||||
// of a peer certificate to make sure it matches the info-hash
|
||||
// of the torrent, or that it's a "star-cert"
|
||||
ctx->set_verify_callback(boost::bind(&torrent::verify_peer_cert, this, _1, _2), ec);
|
||||
ctx->set_verify_callback(std::bind(&torrent::verify_peer_cert, this, _1, _2), ec);
|
||||
if (ec)
|
||||
{
|
||||
set_error(ec, torrent_status::error_file_ssl_ctx);
|
||||
|
@ -1832,7 +1831,7 @@ namespace libtorrent
|
|||
if (m_seed_mode)
|
||||
{
|
||||
m_have_all = true;
|
||||
m_ses.get_io_service().post(boost::bind(&torrent::files_checked, shared_from_this()));
|
||||
m_ses.get_io_service().post(std::bind(&torrent::files_checked, shared_from_this()));
|
||||
m_add_torrent_params.reset();
|
||||
update_gauge();
|
||||
update_state_list();
|
||||
|
@ -1970,7 +1969,7 @@ namespace libtorrent
|
|||
// async_check_files will gut links
|
||||
m_ses.disk_thread().async_check_files(
|
||||
m_storage.get(), m_add_torrent_params ? m_add_torrent_params.get() : NULL
|
||||
, links, boost::bind(&torrent::on_resume_data_checked
|
||||
, links, std::bind(&torrent::on_resume_data_checked
|
||||
, shared_from_this(), _1));
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
debug_log("init, async_check_files");
|
||||
|
@ -2428,7 +2427,7 @@ namespace libtorrent
|
|||
std::vector<std::string> links;
|
||||
inc_refcount("force_recheck");
|
||||
m_ses.disk_thread().async_check_files(m_storage.get(), NULL
|
||||
, links, boost::bind(&torrent::on_force_recheck
|
||||
, links, std::bind(&torrent::on_force_recheck
|
||||
, shared_from_this(), _1));
|
||||
}
|
||||
|
||||
|
@ -2506,7 +2505,7 @@ namespace libtorrent
|
|||
inc_refcount("start_checking");
|
||||
m_ses.disk_thread().async_hash(m_storage.get(), m_checking_piece++
|
||||
, disk_io_job::sequential_access | disk_io_job::volatile_read
|
||||
, boost::bind(&torrent::on_piece_hashed
|
||||
, std::bind(&torrent::on_piece_hashed
|
||||
, shared_from_this(), _1), reinterpret_cast<void*>(1));
|
||||
if (m_checking_piece >= m_torrent_file->num_pieces()) break;
|
||||
}
|
||||
|
@ -2655,7 +2654,7 @@ namespace libtorrent
|
|||
inc_refcount("start_checking");
|
||||
m_ses.disk_thread().async_hash(m_storage.get(), m_checking_piece++
|
||||
, disk_io_job::sequential_access | disk_io_job::volatile_read
|
||||
, boost::bind(&torrent::on_piece_hashed
|
||||
, std::bind(&torrent::on_piece_hashed
|
||||
, shared_from_this(), _1), reinterpret_cast<void*>(1));
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
debug_log("on_piece_hashed, m_checking_piece: %d", m_checking_piece);
|
||||
|
@ -2825,7 +2824,7 @@ namespace libtorrent
|
|||
boost::weak_ptr<torrent> self(shared_from_this());
|
||||
m_ses.dht()->announce(m_torrent_file->info_hash()
|
||||
, port, flags
|
||||
, boost::bind(&torrent::on_dht_announce_response_disp, self, _1));
|
||||
, std::bind(&torrent::on_dht_announce_response_disp, self, _1));
|
||||
}
|
||||
|
||||
void torrent::on_dht_announce_response_disp(boost::weak_ptr<libtorrent::torrent> t
|
||||
|
@ -2858,7 +2857,7 @@ namespace libtorrent
|
|||
if (torrent_file().priv() || (torrent_file().is_i2p()
|
||||
&& !settings().get_bool(settings_pack::allow_i2p_mixed))) return;
|
||||
|
||||
std::for_each(peers.begin(), peers.end(), boost::bind(
|
||||
std::for_each(peers.begin(), peers.end(), std::bind(
|
||||
&torrent::add_peer, this, _1, peer_info::dht, 0));
|
||||
|
||||
do_connect_boost();
|
||||
|
@ -3317,7 +3316,7 @@ namespace libtorrent
|
|||
{
|
||||
ADD_OUTSTANDING_ASYNC("torrent::on_i2p_resolve");
|
||||
r.i2pconn->async_name_lookup(i->hostname.c_str()
|
||||
, boost::bind(&torrent::on_i2p_resolve
|
||||
, std::bind(&torrent::on_i2p_resolve
|
||||
, shared_from_this(), _1, _2));
|
||||
}
|
||||
else
|
||||
|
@ -3334,7 +3333,7 @@ namespace libtorrent
|
|||
{
|
||||
ADD_OUTSTANDING_ASYNC("torrent::on_peer_name_lookup");
|
||||
m_ses.async_resolve(i->hostname, resolver_interface::abort_on_shutdown
|
||||
, boost::bind(&torrent::on_peer_name_lookup
|
||||
, std::bind(&torrent::on_peer_name_lookup
|
||||
, shared_from_this(), _1, _2, i->port));
|
||||
}
|
||||
}
|
||||
|
@ -3396,8 +3395,8 @@ namespace libtorrent
|
|||
&& r.bind_ip != m_ses.get_ipv4_interface().address()
|
||||
&& r.bind_ip != m_ses.get_ipv6_interface().address())
|
||||
{
|
||||
std::list<address>::const_iterator i = std::find_if(tracker_ips.begin()
|
||||
, tracker_ips.end(), boost::bind(&address::is_v4, _1) != tracker_ip.is_v4());
|
||||
auto i = std::find_if(tracker_ips.begin(), tracker_ips.end()
|
||||
, [&] (address const& a) { return a.is_v4() != tracker_ip.is_v4(); });
|
||||
if (i != tracker_ips.end())
|
||||
{
|
||||
// the tracker did resolve to a different type of address, so announce
|
||||
|
@ -4387,7 +4386,7 @@ namespace libtorrent
|
|||
// to read back the blocks that failed, for blame purposes
|
||||
// this way they have a chance to hit the cache
|
||||
m_ses.disk_thread().async_clear_piece(m_storage.get(), index
|
||||
, boost::bind(&torrent::on_piece_sync, shared_from_this(), _1));
|
||||
, std::bind(&torrent::on_piece_sync, shared_from_this(), _1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4578,15 +4577,12 @@ namespace libtorrent
|
|||
sp.piece_index = index;
|
||||
sp.num_peers = num_peers;
|
||||
|
||||
typedef std::vector<suggest_piece_t>::iterator iter;
|
||||
|
||||
std::pair<iter, iter> range = std::equal_range(
|
||||
m_suggested_pieces.begin(), m_suggested_pieces.end(), sp);
|
||||
auto range = std::equal_range(m_suggested_pieces.begin(), m_suggested_pieces.end(), sp);
|
||||
|
||||
// make sure this piece isn't already in the suggested set.
|
||||
// if it is, just ignore it
|
||||
iter i = std::find_if(range.first, range.second
|
||||
, boost::bind(&suggest_piece_t::piece_index, _1) == index);
|
||||
auto i = std::find_if(range.first, range.second
|
||||
, [index] (suggest_piece_t const& p) { return p.piece_index == index; });
|
||||
if (i != range.second) return;
|
||||
|
||||
m_suggested_pieces.insert(range.second, sp);
|
||||
|
@ -4648,17 +4644,17 @@ namespace libtorrent
|
|||
|
||||
// remove write cache entries
|
||||
cs.pieces.erase(std::remove_if(cs.pieces.begin(), cs.pieces.end()
|
||||
, boost::bind(&cached_piece_info::kind, _1) == cached_piece_info::write_cache)
|
||||
, [] (cached_piece_info const& cp) { return cp.kind == cached_piece_info::write_cache; } )
|
||||
, cs.pieces.end());
|
||||
|
||||
std::vector<suggest_piece_t>& pieces = m_suggested_pieces;
|
||||
pieces.clear();
|
||||
pieces.reserve(cs.pieces.size());
|
||||
|
||||
// sort in ascending order, to get most recently used first
|
||||
// sort in decending order, to get most recently used first
|
||||
std::sort(cs.pieces.begin(), cs.pieces.end()
|
||||
, boost::bind(&cached_piece_info::last_use, _1)
|
||||
> boost::bind(&cached_piece_info::last_use, _2));
|
||||
, [] (cached_piece_info const& lhs, cached_piece_info const& rhs)
|
||||
{ return lhs.last_use >= rhs.last_use; });
|
||||
|
||||
for (std::vector<cached_piece_info>::iterator i = cs.pieces.begin()
|
||||
, end(cs.pieces.end()); i != end; ++i)
|
||||
|
@ -4742,7 +4738,7 @@ namespace libtorrent
|
|||
{
|
||||
inc_refcount("release_files");
|
||||
m_ses.disk_thread().async_stop_torrent(m_storage.get()
|
||||
, boost::bind(&torrent::on_cache_flushed, shared_from_this(), _1));
|
||||
, std::bind(&torrent::on_cache_flushed, shared_from_this(), _1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4971,7 +4967,7 @@ namespace libtorrent
|
|||
// defer this by posting it to the end of the message queue.
|
||||
// this gives the client a chance to specify multiple time critical
|
||||
// pieces before libtorrent cancels requests
|
||||
m_ses.get_io_service().post(boost::bind(&torrent::cancel_non_critical, this));
|
||||
m_ses.get_io_service().post(std::bind(&torrent::cancel_non_critical, this));
|
||||
}
|
||||
|
||||
for (std::vector<time_critical_piece>::iterator i = m_time_critical_pieces.begin()
|
||||
|
@ -5336,7 +5332,7 @@ namespace libtorrent
|
|||
{
|
||||
inc_refcount("file_priority");
|
||||
m_ses.disk_thread().async_set_file_priority(m_storage.get()
|
||||
, m_file_priority, boost::bind(&torrent::on_file_priority, this));
|
||||
, m_file_priority, std::bind(&torrent::on_file_priority, this));
|
||||
}
|
||||
|
||||
update_piece_priorities();
|
||||
|
@ -5375,7 +5371,7 @@ namespace libtorrent
|
|||
{
|
||||
inc_refcount("file_priority");
|
||||
m_ses.disk_thread().async_set_file_priority(m_storage.get()
|
||||
, m_file_priority, boost::bind(&torrent::on_file_priority, this));
|
||||
, m_file_priority, std::bind(&torrent::on_file_priority, this));
|
||||
}
|
||||
update_piece_priorities();
|
||||
}
|
||||
|
@ -5465,7 +5461,7 @@ namespace libtorrent
|
|||
// come here several times with the same start_piece, end_piece
|
||||
std::for_each(pieces.begin() + start_piece
|
||||
, pieces.begin() + last_piece + 1
|
||||
, boost::bind(&set_if_greater, _1, file_prio));
|
||||
, std::bind(&set_if_greater, _1, file_prio));
|
||||
|
||||
if (has_picker() || file_prio != 1)
|
||||
need_update = true;
|
||||
|
@ -5685,14 +5681,15 @@ namespace libtorrent
|
|||
bool torrent::add_tracker(announce_entry const& url)
|
||||
{
|
||||
std::vector<announce_entry>::iterator k = std::find_if(m_trackers.begin()
|
||||
, m_trackers.end(), boost::bind(&announce_entry::url, _1) == url.url);
|
||||
, m_trackers.end(), [&url] (announce_entry const& u) { return u.url == url.url; });
|
||||
if (k != m_trackers.end())
|
||||
{
|
||||
k->source |= url.source;
|
||||
return false;
|
||||
}
|
||||
k = std::upper_bound(m_trackers.begin(), m_trackers.end(), url
|
||||
, boost::bind(&announce_entry::tier, _1) < boost::bind(&announce_entry::tier, _2));
|
||||
, [] (announce_entry const& lhs, announce_entry const& rhs)
|
||||
{ return lhs.tier < rhs.tier; });
|
||||
if (k - m_trackers.begin() < m_last_working_tracker) ++m_last_working_tracker;
|
||||
k = m_trackers.insert(k, url);
|
||||
if (k->source == 0) k->source = announce_entry::source_client;
|
||||
|
@ -5732,24 +5729,23 @@ namespace libtorrent
|
|||
|
||||
void torrent::trigger_unchoke()
|
||||
{
|
||||
m_ses.get_io_service().dispatch(boost::bind(
|
||||
&aux::session_interface::trigger_unchoke, boost::ref(m_ses)));
|
||||
m_ses.get_io_service().dispatch(std::bind(
|
||||
&aux::session_interface::trigger_unchoke, std::ref(m_ses)));
|
||||
}
|
||||
|
||||
void torrent::trigger_optimistic_unchoke()
|
||||
{
|
||||
m_ses.get_io_service().dispatch(boost::bind(
|
||||
&aux::session_interface::trigger_optimistic_unchoke, boost::ref(m_ses)));
|
||||
m_ses.get_io_service().dispatch(std::bind(
|
||||
&aux::session_interface::trigger_optimistic_unchoke, std::ref(m_ses)));
|
||||
}
|
||||
|
||||
void torrent::cancel_block(piece_block block)
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
for (peer_iterator i = m_connections.begin()
|
||||
, end(m_connections.end()); i != end; ++i)
|
||||
for (auto p : m_connections)
|
||||
{
|
||||
(*i)->cancel_request(block);
|
||||
p->cancel_request(block);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5785,7 +5781,7 @@ namespace libtorrent
|
|||
|
||||
using boost::asio::ssl::context;
|
||||
error_code ec;
|
||||
m_ssl_ctx->set_password_callback(boost::bind(&password_callback, _1, _2, passphrase), ec);
|
||||
m_ssl_ctx->set_password_callback(std::bind(&password_callback, _1, _2, passphrase), ec);
|
||||
if (ec)
|
||||
{
|
||||
if (alerts().should_post<torrent_error_alert>())
|
||||
|
@ -6103,7 +6099,7 @@ namespace libtorrent
|
|||
// use proxy
|
||||
web->resolving = true;
|
||||
m_ses.async_resolve(ps.hostname, resolver_interface::abort_on_shutdown
|
||||
, boost::bind(&torrent::on_proxy_name_lookup, shared_from_this()
|
||||
, std::bind(&torrent::on_proxy_name_lookup, shared_from_this()
|
||||
, _1, _2, web, ps.port));
|
||||
}
|
||||
else if (ps.proxy_hostnames
|
||||
|
@ -6121,7 +6117,7 @@ namespace libtorrent
|
|||
|
||||
web->resolving = true;
|
||||
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
|
||||
, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
|
||||
, std::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
|
||||
, port, web));
|
||||
}
|
||||
}
|
||||
|
@ -6204,7 +6200,7 @@ namespace libtorrent
|
|||
|
||||
web->resolving = true;
|
||||
m_ses.async_resolve(hostname, resolver_interface::abort_on_shutdown
|
||||
, boost::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
|
||||
, std::bind(&torrent::on_name_lookup, shared_from_this(), _1, _2
|
||||
, port, web));
|
||||
}
|
||||
|
||||
|
@ -6954,7 +6950,7 @@ namespace libtorrent
|
|||
{
|
||||
// this asserts that we don't have duplicates in the peer_list's peer list
|
||||
peer_iterator i_ = std::find_if(m_connections.begin(), m_connections.end()
|
||||
, boost::bind(&peer_connection::remote, _1) == peerinfo->ip());
|
||||
, [peerinfo] (peer_connection const* p) { return p->remote() == peerinfo->ip(); });
|
||||
#if TORRENT_USE_I2P
|
||||
TORRENT_ASSERT(i_ == m_connections.end()
|
||||
|| (*i_)->type() != peer_connection::bittorrent_connection
|
||||
|
@ -7820,7 +7816,7 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
std::for_each(seeds.begin(), seeds.end()
|
||||
, boost::bind(&peer_connection::disconnect, _1, errors::torrent_finished
|
||||
, std::bind(&peer_connection::disconnect, _1, errors::torrent_finished
|
||||
, op_bittorrent, 0));
|
||||
}
|
||||
|
||||
|
@ -7833,7 +7829,7 @@ namespace libtorrent
|
|||
// we need to keep the object alive during this operation
|
||||
inc_refcount("release_files");
|
||||
m_ses.disk_thread().async_release_files(m_storage.get()
|
||||
, boost::bind(&torrent::on_cache_flushed, shared_from_this(), _1));
|
||||
, std::bind(&torrent::on_cache_flushed, shared_from_this(), _1));
|
||||
}
|
||||
|
||||
// this torrent just completed downloads, which means it will fall
|
||||
|
@ -8136,7 +8132,7 @@ namespace libtorrent
|
|||
|
||||
inc_refcount("rename_file");
|
||||
m_ses.disk_thread().async_rename_file(m_storage.get(), index, name
|
||||
, boost::bind(&torrent::on_file_renamed, shared_from_this(), _1));
|
||||
, std::bind(&torrent::on_file_renamed, shared_from_this(), _1));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8173,7 +8169,7 @@ namespace libtorrent
|
|||
#endif
|
||||
inc_refcount("move_storage");
|
||||
m_ses.disk_thread().async_move_storage(m_storage.get(), path, flags
|
||||
, boost::bind(&torrent::on_storage_moved, shared_from_this(), _1));
|
||||
, std::bind(&torrent::on_storage_moved, shared_from_this(), _1));
|
||||
m_moving_storage = true;
|
||||
}
|
||||
else
|
||||
|
@ -8643,7 +8639,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(m_storage);
|
||||
inc_refcount("delete_files");
|
||||
m_ses.disk_thread().async_delete_files(m_storage.get(), options
|
||||
, boost::bind(&torrent::on_files_deleted, shared_from_this(), _1));
|
||||
, std::bind(&torrent::on_files_deleted, shared_from_this(), _1));
|
||||
m_deleted = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -8969,7 +8965,7 @@ namespace libtorrent
|
|||
}
|
||||
inc_refcount("release_files");
|
||||
m_ses.disk_thread().async_release_files(m_storage.get()
|
||||
, boost::bind(&torrent::on_cache_flushed, shared_from_this(), _1));
|
||||
, std::bind(&torrent::on_cache_flushed, shared_from_this(), _1));
|
||||
}
|
||||
|
||||
void torrent::on_cache_flushed(disk_io_job const*)
|
||||
|
@ -9070,7 +9066,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(m_storage);
|
||||
m_ses.disk_thread().async_stop_torrent(m_storage.get()
|
||||
, boost::bind(&torrent::on_torrent_paused, shared_from_this(), _1));
|
||||
, std::bind(&torrent::on_torrent_paused, shared_from_this(), _1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -9360,7 +9356,7 @@ namespace libtorrent
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("tracker::on_tracker_announce_disp");
|
||||
m_tracker_timer.expires_at(next_announce, ec);
|
||||
m_tracker_timer.async_wait(boost::bind(&torrent::on_tracker_announce_disp, self, _1));
|
||||
m_tracker_timer.async_wait(std::bind(&torrent::on_tracker_announce_disp, self, _1));
|
||||
}
|
||||
|
||||
void torrent::start_announcing()
|
||||
|
@ -9410,7 +9406,7 @@ namespace libtorrent
|
|||
{
|
||||
// tell the tracker that we're back
|
||||
std::for_each(m_trackers.begin(), m_trackers.end()
|
||||
, boost::bind(&announce_entry::reset, _1));
|
||||
, std::bind(&announce_entry::reset, _1));
|
||||
}
|
||||
|
||||
// reset the stats, since from the tracker's
|
||||
|
@ -9508,7 +9504,7 @@ namespace libtorrent
|
|||
if (m_storage_tick == 0 && m_storage)
|
||||
{
|
||||
m_ses.disk_thread().async_tick_torrent(&storage()
|
||||
, boost::bind(&torrent::on_disk_tick_done
|
||||
, std::bind(&torrent::on_disk_tick_done
|
||||
, shared_from_this(), _1));
|
||||
update_want_tick();
|
||||
}
|
||||
|
@ -9560,8 +9556,8 @@ namespace libtorrent
|
|||
std::vector<peer_info> peer_list;
|
||||
get_peer_info(peer_list);
|
||||
|
||||
std::sort(queue.begin(), queue.end(), boost::bind(&partial_piece_info::piece_index, _1)
|
||||
< boost::bind(&partial_piece_info::piece_index, _2));
|
||||
std::sort(queue.begin(), queue.end(), std::bind(&partial_piece_info::piece_index, _1)
|
||||
< std::bind(&partial_piece_info::piece_index, _2));
|
||||
|
||||
std::printf("average piece download time: %.2f s (+/- %.2f s)\n"
|
||||
, m_average_piece_time / 1000.f
|
||||
|
@ -9648,7 +9644,7 @@ namespace libtorrent
|
|||
{
|
||||
int delay = settings().get_int(settings_pack::auto_manage_startup);
|
||||
m_inactivity_timer.expires_from_now(seconds(delay));
|
||||
m_inactivity_timer.async_wait(boost::bind(&torrent::on_inactivity_tick
|
||||
m_inactivity_timer.async_wait(std::bind(&torrent::on_inactivity_tick
|
||||
, shared_from_this(), _1));
|
||||
m_pending_active_change = true;
|
||||
}
|
||||
|
@ -9914,7 +9910,7 @@ namespace libtorrent
|
|||
{
|
||||
using namespace libtorrent;
|
||||
std::vector<peer_info>::const_iterator i = std::find_if(peers.begin()
|
||||
, peers.end(), boost::bind(&peer_info::ip, _1) == addr);
|
||||
, peers.end(), std::bind(&peer_info::ip, _1) == addr);
|
||||
if (i == peers.end()) return -1;
|
||||
|
||||
return i - peers.begin();
|
||||
|
@ -9935,7 +9931,7 @@ namespace libtorrent
|
|||
int piece = pp->piece_index;
|
||||
std::vector<time_critical_piece>::const_iterator i
|
||||
= std::find_if(time_critical.begin(), time_critical.end()
|
||||
, boost::bind(&time_critical_piece::piece, _1) == piece);
|
||||
, std::bind(&time_critical_piece::piece, _1) == piece);
|
||||
if (i != time_critical.end())
|
||||
{
|
||||
deadline = total_milliseconds(i->deadline - now) / 1000.f;
|
||||
|
@ -10084,7 +10080,7 @@ namespace libtorrent
|
|||
|
||||
// pick the peer with the lowest download_queue_time that has i->piece
|
||||
std::vector<peer_connection*>::iterator p = std::find_if(peers.begin(), peers.end()
|
||||
, boost::bind(&peer_connection::has_piece, _1, i->piece));
|
||||
, std::bind(&peer_connection::has_piece, _1, i->piece));
|
||||
|
||||
// obviously we'll have to skip it if we don't have a peer that has
|
||||
// this piece
|
||||
|
@ -10263,18 +10259,19 @@ namespace libtorrent
|
|||
// on parole (i.e. they are believed to have sent us bad data), peers
|
||||
// that are being disconnected, in upload mode etc.
|
||||
std::remove_copy_if(m_connections.begin(), m_connections.end()
|
||||
, std::back_inserter(peers), !boost::bind(&peer_connection::can_request_time_critical, _1));
|
||||
, std::back_inserter(peers), [] (peer_connection* p)
|
||||
{ return !p->can_request_time_critical(); });
|
||||
|
||||
// sort by the time we believe it will take this peer to send us all
|
||||
// blocks we've requested from it. The shorter time, the better candidate
|
||||
// it is to request a time critical block from.
|
||||
std::sort(peers.begin(), peers.end()
|
||||
, boost::bind(&peer_connection::download_queue_time, _1, 16*1024)
|
||||
< boost::bind(&peer_connection::download_queue_time, _2, 16*1024));
|
||||
, [] (peer_connection const* lhs, peer_connection const* rhs)
|
||||
{ return lhs->download_queue_time(16*1024) < rhs->download_queue_time(16*1024); });
|
||||
|
||||
// remove the bottom 10% of peers from the candidate set.
|
||||
// this is just to remove outliers that might stall downloads
|
||||
int new_size = int((peers.size() * 9 + 9) / 10);
|
||||
int const new_size = int((peers.size() * 9 + 9) / 10);
|
||||
TORRENT_ASSERT(new_size <= int(peers.size()));
|
||||
peers.resize(new_size);
|
||||
|
||||
|
@ -10402,8 +10399,8 @@ namespace libtorrent
|
|||
// TODO: instead of resorting the whole list, insert the peers
|
||||
// directly into the right place
|
||||
std::sort(peers.begin(), peers.end()
|
||||
, boost::bind(&peer_connection::download_queue_time, _1, 16*1024)
|
||||
< boost::bind(&peer_connection::download_queue_time, _2, 16*1024));
|
||||
, [] (peer_connection const* lhs, peer_connection const* rhs)
|
||||
{ return lhs->download_queue_time(16*1024) < rhs->download_queue_time(16*1024); });
|
||||
}
|
||||
|
||||
// if this peer's download time exceeds 2 seconds, we're done.
|
||||
|
@ -10413,10 +10410,9 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
// commit all the time critical requests
|
||||
for (std::set<peer_connection*>::iterator i = peers_with_requests.begin()
|
||||
, end(peers_with_requests.end()); i != end; ++i)
|
||||
for (auto p : peers_with_requests)
|
||||
{
|
||||
(*i)->send_block_requests();
|
||||
p->send_block_requests();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10439,8 +10435,7 @@ namespace libtorrent
|
|||
{
|
||||
std::list<web_seed_t>::iterator i = std::find_if(m_web_seeds.begin()
|
||||
, m_web_seeds.end()
|
||||
, (boost::bind(&web_seed_t::url, _1)
|
||||
== url && boost::bind(&web_seed_t::type, _1) == type));
|
||||
, [&] (web_seed_t const& w) { return w.url == url && w.type == type; });
|
||||
|
||||
if (i != m_web_seeds.end()) remove_web_seed_iter(i);
|
||||
}
|
||||
|
@ -10449,8 +10444,7 @@ namespace libtorrent
|
|||
{
|
||||
std::list<web_seed_t>::iterator i
|
||||
= std::find_if(m_web_seeds.begin(), m_web_seeds.end()
|
||||
, (boost::bind(&torrent_peer::connection
|
||||
, boost::bind(&web_seed_t::peer_info, _1)) == p));
|
||||
, [p] (web_seed_t const& ws) { return ws.peer_info.connection == p; });
|
||||
|
||||
// this happens if the web server responded with a redirect
|
||||
// or with something incorrect, so that we removed the web seed
|
||||
|
@ -10468,8 +10462,8 @@ namespace libtorrent
|
|||
{
|
||||
std::list<web_seed_t>::iterator i = std::find_if(m_web_seeds.begin()
|
||||
, m_web_seeds.end()
|
||||
, boost::bind(&torrent_peer::connection
|
||||
, boost::bind(&web_seed_t::peer_info, _1)) == p);
|
||||
, [p] (web_seed_t const& ws) { return ws.peer_info.connection == p; });
|
||||
|
||||
TORRENT_ASSERT(i != m_web_seeds.end());
|
||||
if (i == m_web_seeds.end()) return;
|
||||
|
||||
|
@ -10491,8 +10485,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(is_single_thread());
|
||||
std::list<web_seed_t>::iterator i = std::find_if(m_web_seeds.begin()
|
||||
, m_web_seeds.end()
|
||||
, boost::bind(&torrent_peer::connection
|
||||
, boost::bind(&web_seed_t::peer_info, _1)) == p);
|
||||
, [p] (web_seed_t const& ws) { return ws.peer_info.connection == p; });
|
||||
|
||||
TORRENT_ASSERT(i != m_web_seeds.end());
|
||||
if (i == m_web_seeds.end()) return;
|
||||
|
@ -10718,7 +10711,7 @@ namespace libtorrent
|
|||
|
||||
inc_refcount("verify_piece");
|
||||
m_ses.disk_thread().async_hash(m_storage.get(), piece, 0
|
||||
, boost::bind(&torrent::on_piece_verified, shared_from_this(), _1)
|
||||
, std::bind(&torrent::on_piece_verified, shared_from_this(), _1)
|
||||
, reinterpret_cast<void*>(1));
|
||||
}
|
||||
|
||||
|
@ -10726,7 +10719,7 @@ namespace libtorrent
|
|||
{
|
||||
std::vector<announce_entry>::iterator i = std::find_if(
|
||||
m_trackers.begin(), m_trackers.end()
|
||||
, boost::bind(&announce_entry::url, _1) == r.url);
|
||||
, [&r] (announce_entry const& ae) { return ae.url == r.url; });
|
||||
if (i == m_trackers.end()) return 0;
|
||||
return &*i;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <unordered_set>
|
||||
|
@ -1624,8 +1623,9 @@ namespace libtorrent
|
|||
e.source = announce_entry::source_client;
|
||||
m_urls.push_back(e);
|
||||
|
||||
std::sort(m_urls.begin(), m_urls.end(), boost::bind(&announce_entry::tier, _1)
|
||||
< boost::bind(&announce_entry::tier, _2));
|
||||
std::sort(m_urls.begin(), m_urls.end()
|
||||
, [] (announce_entry const& lhs, announce_entry const& rhs)
|
||||
{ return lhs.tier < rhs.tier; });
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
|
|
|
@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <vector>
|
||||
#include <cctype>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
@ -47,8 +47,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/io.hpp"
|
||||
#include "libtorrent/aux_/array_view.hpp"
|
||||
|
||||
using boost::tuples::make_tuple;
|
||||
using boost::tuples::tuple;
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ namespace libtorrent
|
|||
ADD_OUTSTANDING_ASYNC("timeout_handler::timeout_callback");
|
||||
error_code ec;
|
||||
m_timeout.expires_at(m_read_time + seconds(timeout), ec);
|
||||
m_timeout.async_wait(boost::bind(
|
||||
m_timeout.async_wait(std::bind(
|
||||
&timeout_handler::timeout_callback, shared_from_this(), _1));
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ namespace libtorrent
|
|||
error_code ec;
|
||||
m_timeout.expires_at(m_read_time + seconds(timeout), ec);
|
||||
m_timeout.async_wait(
|
||||
boost::bind(&timeout_handler::timeout_callback, shared_from_this(), _1));
|
||||
std::bind(&timeout_handler::timeout_callback, shared_from_this(), _1));
|
||||
}
|
||||
|
||||
tracker_connection::tracker_connection(
|
||||
|
@ -166,7 +166,7 @@ namespace libtorrent
|
|||
, char const* msg, int interval, int min_interval)
|
||||
{
|
||||
// we need to post the error to avoid deadlock
|
||||
get_io_service().post(boost::bind(&tracker_connection::fail_impl
|
||||
get_io_service().post(std::bind(&tracker_connection::fail_impl
|
||||
, shared_from_this(), ec, code, std::string(msg), interval, min_interval));
|
||||
}
|
||||
|
||||
|
@ -236,19 +236,16 @@ namespace libtorrent
|
|||
void tracker_manager::remove_request(tracker_connection const* c)
|
||||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
http_conns_t::iterator i = std::find_if(m_http_conns.begin()
|
||||
, m_http_conns.end()
|
||||
, boost::bind(&boost::shared_ptr<http_tracker_connection>::get, _1) == c);
|
||||
http_conns_t::iterator i = std::find_if(m_http_conns.begin(), m_http_conns.end()
|
||||
, [c] (boost::shared_ptr<http_tracker_connection> const& ptr) { return ptr.get() == c; });
|
||||
if (i != m_http_conns.end())
|
||||
{
|
||||
m_http_conns.erase(i);
|
||||
return;
|
||||
}
|
||||
|
||||
udp_conns_t::iterator j = std::find_if(m_udp_conns.begin()
|
||||
, m_udp_conns.end()
|
||||
, boost::bind(&boost::shared_ptr<udp_tracker_connection>::get
|
||||
, boost::bind(&udp_conns_t::value_type::second, _1)) == c);
|
||||
udp_conns_t::iterator j = std::find_if(m_udp_conns.begin(), m_udp_conns.end()
|
||||
, [c] (udp_conns_t::value_type const& uc) { return uc.second.get() == c; });
|
||||
if (j != m_udp_conns.end())
|
||||
{
|
||||
m_udp_conns.erase(j);
|
||||
|
@ -308,7 +305,7 @@ namespace libtorrent
|
|||
|
||||
// we need to post the error to avoid deadlock
|
||||
if (boost::shared_ptr<request_callback> r = c.lock())
|
||||
ios.post(boost::bind(&request_callback::tracker_request_error, r, req
|
||||
ios.post(std::bind(&request_callback::tracker_request_error, r, req
|
||||
, -1, error_code(errors::unsupported_url_protocol)
|
||||
, "", 0));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <array>
|
||||
#include <boost/system/system_error.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
@ -63,6 +63,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace libtorrent {
|
||||
|
||||
using namespace libtorrent::aux;
|
||||
using namespace std::placeholders;
|
||||
|
||||
// this class hold the state of the SOCKS5 connection to maintain the UDP
|
||||
// ASSOCIATE tunnel. It's instantiated on the heap for two reasons:
|
||||
|
@ -497,7 +498,7 @@ void socks5::start(aux::proxy_settings const& ps)
|
|||
// TODO: use the system resolver_interface here
|
||||
tcp::resolver::query q(ps.hostname, to_string(ps.port).data());
|
||||
ADD_OUTSTANDING_ASYNC("socks5::on_name_lookup");
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
m_resolver.async_resolve(q, std::bind(
|
||||
&socks5::on_name_lookup, self(), _1, _2));
|
||||
}
|
||||
|
||||
|
@ -522,11 +523,11 @@ void socks5::on_name_lookup(error_code const& e, tcp::resolver::iterator i)
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("socks5::on_connected");
|
||||
m_socks5_sock.async_connect(tcp::endpoint(m_proxy_addr.address(), m_proxy_addr.port())
|
||||
, boost::bind(&socks5::on_connected, self(), _1));
|
||||
, std::bind(&socks5::on_connected, self(), _1));
|
||||
|
||||
ADD_OUTSTANDING_ASYNC("socks5::on_connect_timeout");
|
||||
m_timer.expires_from_now(seconds(10));
|
||||
m_timer.async_wait(boost::bind(&socks5::on_connect_timeout
|
||||
m_timer.async_wait(std::bind(&socks5::on_connect_timeout
|
||||
, self(), _1));
|
||||
}
|
||||
|
||||
|
@ -575,7 +576,7 @@ void socks5::on_connected(error_code const& e)
|
|||
TORRENT_ASSERT_VAL(p - m_tmp_buf < int(sizeof(m_tmp_buf)), (p - m_tmp_buf));
|
||||
ADD_OUTSTANDING_ASYNC("socks5::on_handshake1");
|
||||
boost::asio::async_write(m_socks5_sock, boost::asio::buffer(m_tmp_buf, p - m_tmp_buf)
|
||||
, boost::bind(&socks5::handshake1, self(), _1));
|
||||
, std::bind(&socks5::handshake1, self(), _1));
|
||||
}
|
||||
|
||||
void socks5::handshake1(error_code const& e)
|
||||
|
@ -586,7 +587,7 @@ void socks5::handshake1(error_code const& e)
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("socks5::on_handshake2");
|
||||
boost::asio::async_read(m_socks5_sock, boost::asio::buffer(m_tmp_buf, 2)
|
||||
, boost::bind(&socks5::handshake2, self(), _1));
|
||||
, std::bind(&socks5::handshake2, self(), _1));
|
||||
}
|
||||
|
||||
void socks5::handshake2(error_code const& e)
|
||||
|
@ -634,7 +635,7 @@ void socks5::handshake2(error_code const& e)
|
|||
TORRENT_ASSERT_VAL(p - m_tmp_buf < int(sizeof(m_tmp_buf)), (p - m_tmp_buf));
|
||||
ADD_OUTSTANDING_ASYNC("socks5::on_handshake3");
|
||||
boost::asio::async_write(m_socks5_sock, boost::asio::buffer(m_tmp_buf, p - m_tmp_buf)
|
||||
, boost::bind(&socks5::handshake3, self(), _1));
|
||||
, std::bind(&socks5::handshake3, self(), _1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -652,7 +653,7 @@ void socks5::handshake3(error_code const& e)
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("socks5::on_handshake4");
|
||||
boost::asio::async_read(m_socks5_sock, boost::asio::buffer(m_tmp_buf, 2)
|
||||
, boost::bind(&socks5::handshake4, self(), _1));
|
||||
, std::bind(&socks5::handshake4, self(), _1));
|
||||
}
|
||||
|
||||
void socks5::handshake4(error_code const& e)
|
||||
|
@ -688,7 +689,7 @@ void socks5::socks_forward_udp()
|
|||
TORRENT_ASSERT_VAL(p - m_tmp_buf < int(sizeof(m_tmp_buf)), (p - m_tmp_buf));
|
||||
ADD_OUTSTANDING_ASYNC("socks5::connect1");
|
||||
boost::asio::async_write(m_socks5_sock, boost::asio::buffer(m_tmp_buf, p - m_tmp_buf)
|
||||
, boost::bind(&socks5::connect1, self(), _1));
|
||||
, std::bind(&socks5::connect1, self(), _1));
|
||||
}
|
||||
|
||||
void socks5::connect1(error_code const& e)
|
||||
|
@ -699,7 +700,7 @@ void socks5::connect1(error_code const& e)
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("socks5::connect2");
|
||||
boost::asio::async_read(m_socks5_sock, boost::asio::buffer(m_tmp_buf, 10)
|
||||
, boost::bind(&socks5::connect2, self(), _1));
|
||||
, std::bind(&socks5::connect2, self(), _1));
|
||||
}
|
||||
|
||||
void socks5::connect2(error_code const& e)
|
||||
|
@ -737,7 +738,7 @@ void socks5::connect2(error_code const& e)
|
|||
|
||||
ADD_OUTSTANDING_ASYNC("socks5::hung_up");
|
||||
boost::asio::async_read(m_socks5_sock, boost::asio::buffer(m_tmp_buf, 10)
|
||||
, boost::bind(&socks5::hung_up, self(), _1));
|
||||
, std::bind(&socks5::hung_up, self(), _1));
|
||||
}
|
||||
|
||||
void socks5::hung_up(error_code const& e)
|
||||
|
|
|
@ -30,13 +30,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
*/
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <cctype>
|
||||
#include <mutex>
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
@ -59,6 +59,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/socket_io.hpp"
|
||||
#endif
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -120,7 +122,7 @@ namespace libtorrent
|
|||
, tracker_req().event == tracker_request::stopped
|
||||
? resolver_interface::prefer_cache
|
||||
: resolver_interface::abort_on_shutdown
|
||||
, boost::bind(&udp_tracker_connection::name_lookup
|
||||
, std::bind(&udp_tracker_connection::name_lookup
|
||||
, shared_from_this(), _1, _2, port));
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
|
@ -165,7 +167,7 @@ namespace libtorrent
|
|||
if (cb) cb->debug_log("*** UDP_TRACKER trying next IP [ host: \"%s\" ip: \"%s\" ]"
|
||||
, m_hostname.c_str(), print_endpoint(m_target).c_str());
|
||||
#endif
|
||||
get_io_service().post(boost::bind(
|
||||
get_io_service().post(std::bind(
|
||||
&udp_tracker_connection::start_announce, shared_from_this()));
|
||||
|
||||
aux::session_settings const& settings = m_man.settings();
|
||||
|
|
64
src/upnp.cpp
64
src/upnp.cpp
|
@ -44,7 +44,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/asio/ip/host_name.hpp>
|
||||
#include <boost/asio/ip/multicast.hpp>
|
||||
|
@ -53,6 +52,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <cstdlib>
|
||||
#include <cstdio> // for snprintf
|
||||
#include <functional>
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
@ -98,7 +100,7 @@ void upnp::start()
|
|||
TORRENT_ASSERT(is_single_thread());
|
||||
|
||||
error_code ec;
|
||||
m_socket.open(boost::bind(&upnp::on_reply, self(), _1, _2, _3)
|
||||
m_socket.open(std::bind(&upnp::on_reply, self(), _1, _2, _3)
|
||||
, m_refresh_timer.get_io_service(), ec);
|
||||
|
||||
m_mappings.reserve(10);
|
||||
|
@ -152,7 +154,7 @@ void upnp::discover_device_impl()
|
|||
ADD_OUTSTANDING_ASYNC("upnp::resend_request");
|
||||
++m_retry_count;
|
||||
m_broadcast_timer.expires_from_now(seconds(2 * m_retry_count), ec);
|
||||
m_broadcast_timer.async_wait(boost::bind(&upnp::resend_request
|
||||
m_broadcast_timer.async_wait(std::bind(&upnp::resend_request
|
||||
, self(), _1));
|
||||
|
||||
log("broadcasting search for rootdevice");
|
||||
|
@ -174,7 +176,7 @@ int upnp::add_mapping(upnp::protocol_type p, int external_port, int local_port)
|
|||
|
||||
std::vector<global_mapping_t>::iterator mapping_it = std::find_if(
|
||||
m_mappings.begin(), m_mappings.end()
|
||||
, boost::bind(&global_mapping_t::protocol, _1) == int(none));
|
||||
, [](global_mapping_t const& m) { return m.protocol == none; });
|
||||
|
||||
if (mapping_it == m_mappings.end())
|
||||
{
|
||||
|
@ -291,7 +293,7 @@ void upnp::resend_request(error_code const& ec)
|
|||
if (d.upnp_connection) d.upnp_connection->close();
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_resolver
|
||||
, boost::bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||
, std::bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||
, boost::ref(d), _5)));
|
||||
d.upnp_connection->get(d.url, seconds(30), 1);
|
||||
}
|
||||
|
@ -377,8 +379,8 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
|||
if (m_ignore_non_routers)
|
||||
{
|
||||
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
|
||||
if (std::find_if(routes.begin(), routes.end()
|
||||
, boost::bind(&ip_route::gateway, _1) == from.address()) == routes.end())
|
||||
if (std::none_of(routes.begin(), routes.end()
|
||||
, [from] (ip_route const& rt) { return rt.gateway == from.address(); }))
|
||||
{
|
||||
// this upnp device is filtered because it's not in the
|
||||
// list of configured routers
|
||||
|
@ -545,8 +547,7 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
|||
// devices at one of our default routes. If not, we want to override
|
||||
// ignoring them and use them instead (better than not working).
|
||||
m_map_timer.expires_from_now(seconds(1), ec);
|
||||
m_map_timer.async_wait(boost::bind(&upnp::map_timer
|
||||
, self(), _1));
|
||||
m_map_timer.async_wait(std::bind(&upnp::map_timer, self(), _1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -571,9 +572,8 @@ void upnp::try_map_upnp(bool timer)
|
|||
// if we don't ave any devices that match our default route, we
|
||||
// should try to map with the ones we did hear from anyway,
|
||||
// regardless of if they are not running at our gateway.
|
||||
override_ignore_non_routers = std::find_if(m_devices.begin()
|
||||
, m_devices.end(), boost::bind(&rootdevice::non_router, _1) == false)
|
||||
== m_devices.end();
|
||||
override_ignore_non_routers = std::none_of(m_devices.begin()
|
||||
, m_devices.end(), [](rootdevice const& d) { return d.non_router == false; });
|
||||
if (override_ignore_non_routers)
|
||||
{
|
||||
char msg[500];
|
||||
|
@ -609,8 +609,8 @@ void upnp::try_map_upnp(bool timer)
|
|||
if (d.upnp_connection) d.upnp_connection->close();
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_resolver
|
||||
, boost::bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||
, boost::ref(d), _5)));
|
||||
, std::bind(&upnp::on_upnp_xml, self(), _1, _2
|
||||
, std::ref(d), _5)));
|
||||
d.upnp_connection->get(d.url, seconds(30), 1);
|
||||
}
|
||||
TORRENT_CATCH (std::exception& exc)
|
||||
|
@ -704,9 +704,8 @@ void upnp::next(rootdevice& d, int i)
|
|||
}
|
||||
else
|
||||
{
|
||||
std::vector<mapping_t>::iterator j
|
||||
= std::find_if(d.mapping.begin(), d.mapping.end()
|
||||
, boost::bind(&mapping_t::action, _1) != int(mapping_t::action_none));
|
||||
std::vector<mapping_t>::iterator j = std::find_if(d.mapping.begin(), d.mapping.end()
|
||||
, [] (mapping_t const& m) { return m.action != mapping_t::action_none; });
|
||||
if (j == d.mapping.end()) return;
|
||||
|
||||
update_map(d, j - d.mapping.begin());
|
||||
|
@ -756,9 +755,9 @@ void upnp::update_map(rootdevice& d, int i)
|
|||
if (d.upnp_connection) d.upnp_connection->close();
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_resolver
|
||||
, boost::bind(&upnp::on_upnp_map_response, self(), _1, _2
|
||||
, std::bind(&upnp::on_upnp_map_response, self(), _1, _2
|
||||
, boost::ref(d), i, _5), true, default_max_bottled_buffer_size
|
||||
, boost::bind(&upnp::create_port_mapping, self(), _1, boost::ref(d), i)));
|
||||
, std::bind(&upnp::create_port_mapping, self(), _1, boost::ref(d), i)));
|
||||
|
||||
d.upnp_connection->start(d.hostname, d.port
|
||||
, seconds(10), 1);
|
||||
|
@ -768,9 +767,9 @@ void upnp::update_map(rootdevice& d, int i)
|
|||
if (d.upnp_connection) d.upnp_connection->close();
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_resolver
|
||||
, boost::bind(&upnp::on_upnp_unmap_response, self(), _1, _2
|
||||
, std::bind(&upnp::on_upnp_unmap_response, self(), _1, _2
|
||||
, boost::ref(d), i, _5), true, default_max_bottled_buffer_size
|
||||
, boost::bind(&upnp::delete_port_mapping, self(), boost::ref(d), i)));
|
||||
, std::bind(&upnp::delete_port_mapping, self(), boost::ref(d), i)));
|
||||
d.upnp_connection->start(d.hostname, d.port
|
||||
, seconds(10), 1);
|
||||
}
|
||||
|
@ -923,7 +922,7 @@ void upnp::on_upnp_xml(error_code const& e
|
|||
|
||||
parse_state s;
|
||||
xml_parse(p.get_body().begin, p.get_body().end
|
||||
, boost::bind(&find_control_url, _1, _2, _3, boost::ref(s)));
|
||||
, std::bind(&find_control_url, _1, _2, _3, boost::ref(s)));
|
||||
if (s.control_url.empty())
|
||||
{
|
||||
char msg[500];
|
||||
|
@ -986,9 +985,9 @@ void upnp::on_upnp_xml(error_code const& e
|
|||
|
||||
d.upnp_connection.reset(new http_connection(m_io_service
|
||||
, m_resolver
|
||||
, boost::bind(&upnp::on_upnp_get_ip_address_response, self(), _1, _2
|
||||
, std::bind(&upnp::on_upnp_get_ip_address_response, self(), _1, _2
|
||||
, boost::ref(d), _5), true, default_max_bottled_buffer_size
|
||||
, boost::bind(&upnp::get_ip_address, self(), boost::ref(d))));
|
||||
, std::bind(&upnp::get_ip_address, self(), boost::ref(d))));
|
||||
d.upnp_connection->start(d.hostname, d.port
|
||||
, seconds(10), 1);
|
||||
}
|
||||
|
@ -1135,7 +1134,8 @@ struct upnp_error_category : boost::system::error_category
|
|||
error_code_t* end = error_codes + num_errors;
|
||||
error_code_t tmp = {ev, 0};
|
||||
error_code_t* e = std::lower_bound(error_codes, end, tmp
|
||||
, boost::bind(&error_code_t::code, _1) < boost::bind(&error_code_t::code, _2));
|
||||
, [] (error_code_t const& lhs, error_code_t const& rhs)
|
||||
{ return lhs.code < rhs.code; });
|
||||
if (e != end && e->code == ev)
|
||||
{
|
||||
return e->msg;
|
||||
|
@ -1219,7 +1219,7 @@ void upnp::on_upnp_get_ip_address_response(error_code const& e
|
|||
|
||||
ip_address_parse_state s;
|
||||
xml_parse(const_cast<char*>(p.get_body().begin), const_cast<char*>(p.get_body().end)
|
||||
, boost::bind(&find_ip_address, _1, _2, boost::ref(s)));
|
||||
, std::bind(&find_ip_address, _1, _2, boost::ref(s)));
|
||||
if (s.error_code != -1)
|
||||
{
|
||||
char msg[500];
|
||||
|
@ -1312,7 +1312,7 @@ void upnp::on_upnp_map_response(error_code const& e
|
|||
error_code_parse_state s;
|
||||
xml_parse(const_cast<char*>(p.get_body().begin)
|
||||
, const_cast<char*>(p.get_body().end)
|
||||
, boost::bind(&find_error_code, _1, _2, boost::ref(s)));
|
||||
, std::bind(&find_error_code, _1, _2, boost::ref(s)));
|
||||
|
||||
if (s.error_code != -1)
|
||||
{
|
||||
|
@ -1372,7 +1372,7 @@ void upnp::on_upnp_map_response(error_code const& e
|
|||
ADD_OUTSTANDING_ASYNC("upnp::on_expire");
|
||||
error_code ec;
|
||||
m_refresh_timer.expires_at(m.expires, ec);
|
||||
m_refresh_timer.async_wait(boost::bind(&upnp::on_expire, self(), _1));
|
||||
m_refresh_timer.async_wait(std::bind(&upnp::on_expire, self(), _1));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1392,7 +1392,9 @@ void upnp::return_error(int mapping, int code)
|
|||
error_code_t* end = error_codes + num_errors;
|
||||
error_code_t tmp = {code, 0};
|
||||
error_code_t* e = std::lower_bound(error_codes, end, tmp
|
||||
, boost::bind(&error_code_t::code, _1) < boost::bind(&error_code_t::code, _2));
|
||||
, [] (error_code_t const& lhs, error_code_t const& rhs)
|
||||
{ return lhs.code < rhs.code; });
|
||||
|
||||
std::string error_string = "UPnP mapping error ";
|
||||
error_string += to_string(code).data();
|
||||
if (e != end && e->code == code)
|
||||
|
@ -1449,7 +1451,7 @@ void upnp::on_upnp_unmap_response(error_code const& e
|
|||
{
|
||||
xml_parse(const_cast<char*>(p.get_body().begin)
|
||||
, const_cast<char*>(p.get_body().end)
|
||||
, boost::bind(&find_error_code, _1, _2, boost::ref(s)));
|
||||
, std::bind(&find_error_code, _1, _2, boost::ref(s)));
|
||||
}
|
||||
|
||||
int const proto = m_mappings[mapping].protocol;
|
||||
|
@ -1498,7 +1500,7 @@ void upnp::on_expire(error_code const& ec)
|
|||
ADD_OUTSTANDING_ASYNC("upnp::on_expire");
|
||||
error_code e;
|
||||
m_refresh_timer.expires_at(next_expire, e);
|
||||
m_refresh_timer.async_wait(boost::bind(&upnp::on_expire, self(), _1));
|
||||
m_refresh_timer.async_wait(std::bind(&upnp::on_expire, self(), _1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
@ -58,6 +58,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/performance_counters.hpp" // for counters
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace libtorrent { namespace
|
||||
{
|
||||
enum
|
||||
|
@ -618,9 +620,8 @@ namespace libtorrent { namespace
|
|||
m_requested_metadata[piece].num_requests = (std::numeric_limits<int>::max)();
|
||||
m_requested_metadata[piece].source = source.shared_from_this();
|
||||
|
||||
bool have_all = std::count_if(m_requested_metadata.begin()
|
||||
, m_requested_metadata.end(), boost::bind(&metadata_piece::num_requests, _1)
|
||||
== (std::numeric_limits<int>::max)()) == int(m_requested_metadata.size());
|
||||
bool have_all = std::all_of(m_requested_metadata.begin(), m_requested_metadata.end()
|
||||
, [](metadata_piece const& mp) -> bool { return mp.num_requests == (std::numeric_limits<int>::max)(); });
|
||||
|
||||
if (!have_all) return false;
|
||||
|
||||
|
|
|
@ -937,7 +937,7 @@ void utp_stream::on_read(void* self, size_t bytes_transferred
|
|||
|
||||
TORRENT_ASSERT(s->m_read_handler);
|
||||
TORRENT_ASSERT(bytes_transferred > 0 || ec || s->m_impl->m_null_buffers);
|
||||
s->m_io_service.post(boost::bind<void>(s->m_read_handler, ec, bytes_transferred));
|
||||
s->m_io_service.post(std::bind<void>(s->m_read_handler, ec, bytes_transferred));
|
||||
s->m_read_handler.clear();
|
||||
// boost::function2<void, error_code const&, std::size_t> tmp;
|
||||
// tmp.swap(s->m_read_handler);
|
||||
|
@ -961,7 +961,7 @@ void utp_stream::on_write(void* self, size_t bytes_transferred
|
|||
|
||||
TORRENT_ASSERT(s->m_write_handler);
|
||||
TORRENT_ASSERT(bytes_transferred > 0 || ec);
|
||||
s->m_io_service.post(boost::bind<void>(s->m_write_handler, ec, bytes_transferred));
|
||||
s->m_io_service.post(std::bind<void>(s->m_write_handler, ec, bytes_transferred));
|
||||
s->m_write_handler.clear();
|
||||
// boost::function2<void, error_code const&, std::size_t> tmp;
|
||||
// tmp.swap(s->m_read_handler);
|
||||
|
@ -983,7 +983,7 @@ void utp_stream::on_connect(void* self, error_code const& ec, bool kill)
|
|||
, static_cast<void*>(s->m_impl), ec.message().c_str(), kill);
|
||||
|
||||
TORRENT_ASSERT(s->m_connect_handler);
|
||||
s->m_io_service.post(boost::bind<void>(s->m_connect_handler, ec));
|
||||
s->m_io_service.post(std::bind<void>(s->m_connect_handler, ec));
|
||||
s->m_connect_handler.clear();
|
||||
// boost::function1<void, error_code const&> tmp;
|
||||
// s->m_connect_handler.swap(tmp);
|
||||
|
|
|
@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
|
@ -190,7 +190,7 @@ void web_peer_connection::disconnect(error_code const& ec
|
|||
// if the web server doesn't support keepalive and we were
|
||||
// disconnected as a graceful EOF, reconnect right away
|
||||
if (t) get_io_service().post(
|
||||
boost::bind(&torrent::maybe_connect_web_seeds, t));
|
||||
std::bind(&torrent::maybe_connect_web_seeds, t));
|
||||
}
|
||||
peer_connection::disconnect(ec, op, error);
|
||||
if (t) t->disconnect_web_seed(this);
|
||||
|
@ -426,7 +426,7 @@ void web_peer_connection::write_request(peer_request const& r)
|
|||
|
||||
if (num_pad_files == int(m_file_requests.size()))
|
||||
{
|
||||
get_io_service().post(boost::bind(
|
||||
get_io_service().post(std::bind(
|
||||
&web_peer_connection::on_receive_padfile,
|
||||
boost::static_pointer_cast<web_peer_connection>(self())));
|
||||
return;
|
||||
|
|
|
@ -38,10 +38,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "libtorrent/io_service.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
peer_conn::peer_conn(io_service& ios
|
||||
, boost::function<void(int, char const*, int)> on_msg
|
||||
|
@ -74,7 +76,7 @@ peer_conn::peer_conn(io_service& ios
|
|||
void peer_conn::start_conn()
|
||||
{
|
||||
restarting = false;
|
||||
s.async_connect(endpoint, boost::bind(&peer_conn::on_connect, this, _1));
|
||||
s.async_connect(endpoint, std::bind(&peer_conn::on_connect, this, _1));
|
||||
}
|
||||
|
||||
void peer_conn::on_connect(error_code const& ec)
|
||||
|
@ -96,7 +98,7 @@ void peer_conn::on_connect(error_code const& ec)
|
|||
// for seeds, don't send the interested message
|
||||
boost::asio::async_write(s, boost::asio::buffer(h, (sizeof(handshake) - 1)
|
||||
- (m_mode == uploader ? 5 : 0))
|
||||
, boost::bind(&peer_conn::on_handshake, this, h, _1, _2));
|
||||
, std::bind(&peer_conn::on_handshake, this, h, _1, _2));
|
||||
}
|
||||
|
||||
void peer_conn::on_handshake(char* h, error_code const& ec, size_t bytes_transferred)
|
||||
|
@ -110,7 +112,7 @@ void peer_conn::on_handshake(char* h, error_code const& ec, size_t bytes_transfe
|
|||
|
||||
// read handshake
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 68)
|
||||
, boost::bind(&peer_conn::on_handshake2, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_handshake2, this, _1, _2));
|
||||
}
|
||||
|
||||
void peer_conn::on_handshake2(error_code const& ec, size_t bytes_transferred)
|
||||
|
@ -151,7 +153,7 @@ void peer_conn::write_have_all()
|
|||
write_uint8(1, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto, ptr - write_buf_proto)
|
||||
, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -167,7 +169,7 @@ void peer_conn::write_have_all()
|
|||
write_uint8(1, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer((char*)buffer, len + 10)
|
||||
, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,7 +183,7 @@ void peer_conn::on_have_all_sent(error_code const& ec, size_t bytes_transferred)
|
|||
|
||||
// read message
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 4)
|
||||
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
}
|
||||
|
||||
bool peer_conn::write_request()
|
||||
|
@ -232,7 +234,7 @@ bool peer_conn::write_request()
|
|||
write_uint32(16 * 1024, ptr);
|
||||
error_code ec;
|
||||
boost::asio::async_write(s, boost::asio::buffer(m, sizeof(msg) - 1)
|
||||
, boost::bind(&peer_conn::on_req_sent, this, m, _1, _2));
|
||||
, std::bind(&peer_conn::on_req_sent, this, m, _1, _2));
|
||||
|
||||
++outstanding_requests;
|
||||
++block;
|
||||
|
@ -302,7 +304,7 @@ void peer_conn::work_download()
|
|||
|
||||
// read message
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 4)
|
||||
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
}
|
||||
|
||||
void peer_conn::on_msg_length(error_code const& ec, size_t bytes_transferred)
|
||||
|
@ -333,12 +335,12 @@ void peer_conn::on_msg_length(error_code const& ec, size_t bytes_transferred)
|
|||
{
|
||||
// keep-alive messate. read another length prefix
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 4)
|
||||
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, length)
|
||||
, boost::bind(&peer_conn::on_message, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_message, this, _1, _2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,7 +389,7 @@ void peer_conn::on_message(error_code const& ec, size_t bytes_transferred)
|
|||
{
|
||||
// read another message
|
||||
boost::asio::async_read(s, boost::asio::buffer(buffer, 4)
|
||||
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
}
|
||||
break;
|
||||
case peer_conn::downloader:
|
||||
|
@ -503,7 +505,7 @@ void peer_conn::on_message(error_code const& ec, size_t bytes_transferred)
|
|||
case peer_conn::idle:
|
||||
// read another message
|
||||
boost::asio::async_read(s, boost::asio::buffer(buffer, 4)
|
||||
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -539,7 +541,7 @@ void peer_conn::write_piece(int piece, int start, int length)
|
|||
std::array<boost::asio::const_buffer, 2> vec;
|
||||
vec[0] = boost::asio::buffer(write_buf_proto, ptr - write_buf_proto);
|
||||
vec[1] = boost::asio::buffer(write_buffer, length);
|
||||
boost::asio::async_write(s, vec, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
boost::asio::async_write(s, vec, std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
++blocks_sent;
|
||||
}
|
||||
|
||||
|
@ -551,7 +553,7 @@ void peer_conn::write_have(int piece)
|
|||
write_uint32(5, ptr);
|
||||
write_uint8(4, ptr);
|
||||
write_uint32(piece, ptr);
|
||||
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto, 9), boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
boost::asio::async_write(s, boost::asio::buffer(write_buf_proto, 9), std::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
}
|
||||
|
||||
void peer_conn::abort()
|
||||
|
|
|
@ -43,15 +43,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/detail/atomic_count.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#if defined TORRENT_DEBUG && TORRENT_USE_IOSTREAM
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
struct dht_server
|
||||
{
|
||||
|
@ -124,7 +125,7 @@ struct dht_server
|
|||
bool done = false;
|
||||
m_socket.async_receive_from(
|
||||
boost::asio::buffer(buffer, sizeof(buffer)), from, 0
|
||||
, boost::bind(&incoming_packet, _1, _2, &bytes_transferred, &ec, &done));
|
||||
, std::bind(&incoming_packet, _1, _2, &bytes_transferred, &ec, &done));
|
||||
while (!done)
|
||||
{
|
||||
m_ios.poll_one();
|
||||
|
|
|
@ -44,12 +44,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/detail/atomic_count.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include <condition_variable>
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
struct peer_server
|
||||
{
|
||||
|
@ -124,7 +125,7 @@ struct peer_server
|
|||
tcp::socket socket(m_ios);
|
||||
std::condition_variable cond;
|
||||
bool done = false;
|
||||
m_acceptor.async_accept(socket, from, boost::bind(&new_connection, _1, &ec, &done));
|
||||
m_acceptor.async_accept(socket, from, std::bind(&new_connection, _1, &ec, &done));
|
||||
while (!done)
|
||||
{
|
||||
m_ios.poll_one();
|
||||
|
|
|
@ -51,7 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/hex.hpp" // to_hex, from_hex
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "test.hpp"
|
||||
|
|
|
@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/extensions.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
|
@ -123,7 +123,7 @@ TORRENT_TEST(notify_function)
|
|||
|
||||
// if there are queued alerts when we set the notify function,
|
||||
// that counts as an edge and it's called
|
||||
mgr.set_notify_function(boost::bind(&test_notify_fun, boost::ref(cnt)));
|
||||
mgr.set_notify_function(std::bind(&test_notify_fun, boost::ref(cnt)));
|
||||
|
||||
TEST_EQUAL(mgr.pending(), true);
|
||||
TEST_EQUAL(cnt, 1);
|
||||
|
|
|
@ -42,16 +42,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/session_settings.hpp"
|
||||
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include <math.h>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
|
||||
struct torrent;
|
||||
struct peer_connection;
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
const float sample_time = 20.f; // seconds
|
||||
|
||||
|
@ -137,7 +139,7 @@ void do_change_peer_rate(connections_t& v, int limit)
|
|||
if (count == 0)
|
||||
{
|
||||
std::for_each(v.begin(), v.end()
|
||||
, boost::bind(&peer_connection::throttle, _1, limit));
|
||||
, std::bind(&peer_connection::throttle, _1, limit));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -155,7 +157,7 @@ void run_test(connections_t& v
|
|||
std::cerr << "-------------" << std::endl;
|
||||
|
||||
std::for_each(v.begin(), v.end()
|
||||
, boost::bind(&peer_connection::start, _1));
|
||||
, std::bind(&peer_connection::start, _1));
|
||||
|
||||
libtorrent::aux::session_settings s;
|
||||
initialize_default_settings(s);
|
||||
|
@ -229,9 +231,9 @@ void test_connections_variable_rate(int num, int limit, int torrent_limit)
|
|||
connections_t v;
|
||||
spawn_connections(v, manager, t1, num, "p");
|
||||
std::for_each(v.begin(), v.end()
|
||||
, boost::bind(&peer_connection::throttle, _1, limit));
|
||||
, std::bind(&peer_connection::throttle, _1, limit));
|
||||
|
||||
run_test(v, manager, boost::bind(&do_change_peer_rate
|
||||
run_test(v, manager, std::bind(&do_change_peer_rate
|
||||
, boost::ref(v), limit));
|
||||
|
||||
if (torrent_limit > 0 && limit * num > torrent_limit)
|
||||
|
@ -356,7 +358,7 @@ void test_torrents_variable_rate(int num, int limit, int global_limit)
|
|||
std::copy(v1.begin(), v1.end(), std::back_inserter(v));
|
||||
std::copy(v2.begin(), v2.end(), std::back_inserter(v));
|
||||
|
||||
run_test(v, manager, boost::bind(&do_change_rate, boost::ref(t1), boost::ref(t2), limit));
|
||||
run_test(v, manager, std::bind(&do_change_rate, boost::ref(t1), boost::ref(t2), limit));
|
||||
|
||||
if (global_limit > 0 && global_limit < 2 * limit)
|
||||
limit = global_limit / 2;
|
||||
|
|
|
@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/session.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
|
@ -87,7 +87,7 @@ static void nop() {}
|
|||
|
||||
#define TEST_SETUP \
|
||||
io_service ios; \
|
||||
block_cache bc(0x4000, ios, boost::bind(&nop)); \
|
||||
block_cache bc(0x4000, ios, std::bind(&nop)); \
|
||||
aux::session_settings sett; \
|
||||
file_storage fs; \
|
||||
fs.add_file("a/test0", 0x4000); \
|
||||
|
|
|
@ -58,8 +58,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
using namespace libtorrent;
|
||||
using namespace libtorrent::dht;
|
||||
|
||||
void nop() {}
|
||||
using namespace std::placeholders;
|
||||
|
||||
static sha1_hash to_hash(char const* s)
|
||||
{
|
||||
|
@ -87,6 +86,7 @@ void node_push_back(void* userdata, libtorrent::dht::node_entry const& n)
|
|||
}
|
||||
|
||||
static void nop(void* userdata, libtorrent::dht::node_entry const& n) {}
|
||||
static void nop_node() {}
|
||||
|
||||
std::list<std::pair<udp::endpoint, entry> > g_sent_packets;
|
||||
|
||||
|
@ -122,7 +122,8 @@ std::list<std::pair<udp::endpoint, entry> >::iterator
|
|||
find_packet(udp::endpoint ep)
|
||||
{
|
||||
return std::find_if(g_sent_packets.begin(), g_sent_packets.end()
|
||||
, boost::bind(&std::pair<udp::endpoint, entry>::first, _1) == ep);
|
||||
, [&ep] (std::pair<udp::endpoint, entry> const& p)
|
||||
{ return p.first == ep; });
|
||||
}
|
||||
|
||||
void lazy_from_entry(entry const& e, bdecode_node& l)
|
||||
|
@ -1324,14 +1325,14 @@ void do_test_dht(address(&rand_addr)())
|
|||
std::printf("returned: %d\n", int(temp.size()));
|
||||
TEST_EQUAL(int(temp.size()), (std::min)(bucket_size * 2, int(nodes.size())));
|
||||
|
||||
std::sort(nodes.begin(), nodes.end(), boost::bind(&compare_ref
|
||||
, boost::bind(&node_entry::id, _1)
|
||||
, boost::bind(&node_entry::id, _2), tmp));
|
||||
std::sort(nodes.begin(), nodes.end(), std::bind(&compare_ref
|
||||
, std::bind(&node_entry::id, _1)
|
||||
, std::bind(&node_entry::id, _2), tmp));
|
||||
|
||||
int expected = std::accumulate(nodes.begin(), nodes.begin() + (bucket_size * 2)
|
||||
, 0, boost::bind(&sum_distance_exp, _1, _2, tmp));
|
||||
, 0, std::bind(&sum_distance_exp, _1, _2, tmp));
|
||||
int sum_hits = std::accumulate(temp.begin(), temp.end()
|
||||
, 0, boost::bind(&sum_distance_exp, _1, _2, tmp));
|
||||
, 0, std::bind(&sum_distance_exp, _1, _2, tmp));
|
||||
TEST_EQUAL(bucket_size * 2, int(temp.size()));
|
||||
std::printf("expected: %d actual: %d\n", expected, sum_hits);
|
||||
TEST_EQUAL(expected, sum_hits);
|
||||
|
@ -1429,7 +1430,7 @@ void do_test_dht(address(&rand_addr)())
|
|||
udp::endpoint initial_node(address_v4::from_string("4.4.4.4"), 1234);
|
||||
std::vector<udp::endpoint> nodesv;
|
||||
nodesv.push_back(initial_node);
|
||||
node.bootstrap(nodesv, boost::bind(&nop));
|
||||
node.bootstrap(nodesv, std::bind(&nop_node));
|
||||
|
||||
TEST_EQUAL(g_sent_packets.size(), 1);
|
||||
if (g_sent_packets.empty()) break;
|
||||
|
@ -1746,7 +1747,7 @@ void do_test_dht(address(&rand_addr)())
|
|||
sha1_hash target = item_target_id(
|
||||
std::pair<char const*, int>(flat_data.c_str(), int(flat_data.size())));
|
||||
|
||||
node.put_item(target, put_data, boost::bind(&put_immutable_item_cb, _1, loop));
|
||||
node.put_item(target, put_data, std::bind(&put_immutable_item_cb, _1, loop));
|
||||
|
||||
TEST_EQUAL(g_sent_packets.size(), 8);
|
||||
if (g_sent_packets.size() != 8) break;
|
||||
|
@ -1842,7 +1843,7 @@ void do_test_dht(address(&rand_addr)())
|
|||
g_put_item.assign(items[0].ent, empty_salt, seq, public_key, private_key);
|
||||
std::string sig(g_put_item.sig().data(), item_sig_len);
|
||||
node.put_item(public_key, std::string()
|
||||
, boost::bind(&put_mutable_item_cb, _1, _2, loop)
|
||||
, std::bind(&put_mutable_item_cb, _1, _2, loop)
|
||||
, put_mutable_item_data_cb);
|
||||
|
||||
TEST_EQUAL(g_sent_packets.size(), 8);
|
||||
|
@ -1952,7 +1953,7 @@ void do_test_dht(address(&rand_addr)())
|
|||
// kick off a mutable put request
|
||||
g_put_item.assign(items[0].ent, empty_salt, seq, public_key, private_key);
|
||||
node.put_item(public_key, std::string()
|
||||
, boost::bind(&put_mutable_item_cb, _1, _2, 0)
|
||||
, std::bind(&put_mutable_item_cb, _1, _2, 0)
|
||||
, put_mutable_item_data_cb);
|
||||
TEST_EQUAL(g_sent_packets.size(), 8);
|
||||
if (g_sent_packets.size() != 8) break;
|
||||
|
@ -2445,7 +2446,7 @@ TORRENT_TEST(routing_table_set_id)
|
|||
TEST_EQUAL(tbl.num_active_buckets(), 6);
|
||||
|
||||
std::set<node_id> original_nodes;
|
||||
tbl.for_each_node(boost::bind(&inserter, &original_nodes, _1));
|
||||
tbl.for_each_node(std::bind(&inserter, &original_nodes, _1));
|
||||
|
||||
#if defined TORRENT_DEBUG
|
||||
tbl.print_state(std::cerr);
|
||||
|
@ -2457,7 +2458,7 @@ TORRENT_TEST(routing_table_set_id)
|
|||
|
||||
TEST_CHECK(tbl.num_active_buckets() <= 4);
|
||||
std::set<node_id> remaining_nodes;
|
||||
tbl.for_each_node(boost::bind(&inserter, &remaining_nodes, _1));
|
||||
tbl.for_each_node(std::bind(&inserter, &remaining_nodes, _1));
|
||||
|
||||
std::set<node_id> intersection;
|
||||
std::set_intersection(remaining_nodes.begin(), remaining_nodes.end()
|
||||
|
|
|
@ -44,16 +44,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/entry.hpp"
|
||||
#include "libtorrent/torrent_info.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <cstdarg>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
namespace lt = libtorrent;
|
||||
|
||||
void log(char const* fmt, ...)
|
||||
|
@ -466,7 +463,7 @@ TORRENT_TEST(reject_fast)
|
|||
allowed_fast.push_back(3);
|
||||
|
||||
std::for_each(allowed_fast.begin(), allowed_fast.end()
|
||||
, boost::bind(&send_allow_fast, boost::ref(s), _1));
|
||||
, std::bind(&send_allow_fast, boost::ref(s), _1));
|
||||
print_session_log(*ses);
|
||||
|
||||
while (!allowed_fast.empty())
|
||||
|
@ -575,7 +572,7 @@ TORRENT_TEST(reject_suggest)
|
|||
suggested.push_back(3);
|
||||
|
||||
std::for_each(suggested.begin(), suggested.end()
|
||||
, boost::bind(&send_suggest_piece, boost::ref(s), _1));
|
||||
, std::bind(&send_suggest_piece, boost::ref(s), _1));
|
||||
print_session_log(*ses);
|
||||
|
||||
send_unchoke(s);
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/natpmp.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <iostream>
|
||||
|
@ -75,14 +75,14 @@ int main(int argc, char* argv[])
|
|||
|
||||
error_code ec;
|
||||
timer.expires_from_now(seconds(2), ec);
|
||||
timer.async_wait(boost::bind(&io_service::stop, boost::ref(ios)));
|
||||
timer.async_wait(std::bind(&io_service::stop, boost::ref(ios)));
|
||||
std::cerr << "mapping ports TCP: " << argv[1]
|
||||
<< " UDP: " << argv[2] << std::endl;
|
||||
|
||||
ios.reset();
|
||||
ios.run(ec);
|
||||
timer.expires_from_now(seconds(2), ec);
|
||||
timer.async_wait(boost::bind(&io_service::stop, boost::ref(ios)));
|
||||
timer.async_wait(std::bind(&io_service::stop, boost::ref(ios)));
|
||||
std::cerr << "removing mapping " << tcp_map << std::endl;
|
||||
natpmp_handler->delete_mapping(tcp_map);
|
||||
|
||||
|
|
|
@ -39,18 +39,20 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include "test.hpp"
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
const int blocks_per_piece = 4;
|
||||
|
||||
|
@ -468,7 +470,7 @@ TORRENT_TEST(piece_picker)
|
|||
print_title("test pick lowest availability");
|
||||
p = setup_picker("2223333", "* * * ", "", "");
|
||||
TEST_CHECK(test_pick(p) == 1);
|
||||
|
||||
|
||||
// ========================================================
|
||||
|
||||
// make sure pieces with equal priority and availability
|
||||
|
@ -1777,15 +1779,12 @@ TORRENT_TEST(piece_picker)
|
|||
// the download queue should have piece 1, 2 and 3 in it
|
||||
TEST_EQUAL(downloads.size(), 3);
|
||||
|
||||
TEST_CHECK(std::find_if(downloads.begin(), downloads.end()
|
||||
, boost::bind(&piece_picker::downloading_piece::index, _1)
|
||||
== boost::uint32_t(1)) != downloads.end());
|
||||
TEST_CHECK(std::find_if(downloads.begin(), downloads.end()
|
||||
, boost::bind(&piece_picker::downloading_piece::index, _1)
|
||||
== boost::uint32_t(2)) != downloads.end());
|
||||
TEST_CHECK(std::find_if(downloads.begin(), downloads.end()
|
||||
, boost::bind(&piece_picker::downloading_piece::index, _1)
|
||||
== boost::uint32_t(3)) != downloads.end());
|
||||
TEST_EQUAL(std::count_if(downloads.begin(), downloads.end()
|
||||
, [](piece_picker::downloading_piece const& p) { return p.index == 1; }), 1);
|
||||
TEST_EQUAL(std::count_if(downloads.begin(), downloads.end()
|
||||
, [](piece_picker::downloading_piece const& p) { return p.index == 2; }), 1);
|
||||
TEST_EQUAL(std::count_if(downloads.begin(), downloads.end()
|
||||
, [](piece_picker::downloading_piece const& p) { return p.index == 3; }), 1);
|
||||
|
||||
// ========================================================
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "libtorrent/read_resume_data.hpp"
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
|
|
|
@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/file.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
|
|
|
@ -36,9 +36,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/file.hpp" // for combine_path
|
||||
#include "libtorrent/hex.hpp" // to_hex, from_hex
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
struct test_torrent_t
|
||||
{
|
||||
|
@ -110,7 +111,7 @@ TORRENT_TEST(resolve_links)
|
|||
std::vector<resolve_links::link_t> const& links = l.get_links();
|
||||
|
||||
std::string::size_type num_matches = std::count_if(links.begin(), links.end()
|
||||
, boost::bind(&resolve_links::link_t::ti, _1));
|
||||
, std::bind(&resolve_links::link_t::ti, _1));
|
||||
|
||||
// some debug output in case the test fails
|
||||
if (num_matches > e.expected_matches)
|
||||
|
|
|
@ -31,13 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
#include "libtorrent/session.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
#include <functional>
|
||||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
|
@ -50,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <fstream>
|
||||
|
||||
using namespace std::placeholders;
|
||||
using namespace libtorrent;
|
||||
namespace lt = libtorrent;
|
||||
|
||||
|
@ -159,7 +154,7 @@ TORRENT_TEST(load_empty_file)
|
|||
|
||||
add_torrent_params atp;
|
||||
error_code ignore_errors;
|
||||
atp.ti = boost::make_shared<torrent_info>("", 0, boost::ref(ignore_errors));
|
||||
atp.ti = boost::make_shared<torrent_info>("", 0, std::ref(ignore_errors));
|
||||
atp.save_path = ".";
|
||||
error_code ec;
|
||||
torrent_handle h = ses.add_torrent(atp, ec);
|
||||
|
@ -172,8 +167,8 @@ TORRENT_TEST(session_stats)
|
|||
{
|
||||
std::vector<stats_metric> stats = session_stats_metrics();
|
||||
std::sort(stats.begin(), stats.end()
|
||||
, boost::bind(&stats_metric::value_index, _1)
|
||||
< boost::bind(&stats_metric::value_index, _2));
|
||||
, [](stats_metric const& lhs, stats_metric const& rhs)
|
||||
{ return lhs.value_index < rhs.value_index; });
|
||||
|
||||
TEST_EQUAL(stats.size(), lt::counters::num_counters);
|
||||
// make sure every stat index is represented in the stats_metric vector
|
||||
|
|
|
@ -43,11 +43,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <boost/asio/connect.hpp>
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
@ -56,6 +53,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std::placeholders;
|
||||
using namespace libtorrent;
|
||||
using boost::tuples::ignore;
|
||||
|
||||
|
@ -398,7 +400,7 @@ bool try_connect(libtorrent::session& ses1, int port
|
|||
if (flags & (valid_certificate | invalid_certificate))
|
||||
{
|
||||
std::fprintf(stderr, "set_password_callback\n");
|
||||
ctx.set_password_callback(boost::bind(&password_callback, _1, _2, "test"), ec);
|
||||
ctx.set_password_callback(std::bind(&password_callback, _1, _2, "test"), ec);
|
||||
if (ec)
|
||||
{
|
||||
std::fprintf(stderr, "Failed to set certificate password callback: %s\n"
|
||||
|
|
|
@ -51,6 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std::placeholders;
|
||||
using namespace libtorrent;
|
||||
namespace lt = libtorrent;
|
||||
|
||||
|
@ -215,7 +216,7 @@ void run_storage_tests(boost::shared_ptr<torrent_info> info
|
|||
{ // avoid having two storages use the same files
|
||||
file_pool fp;
|
||||
boost::asio::io_service ios;
|
||||
disk_buffer_pool dp(16 * 1024, ios, boost::bind(&nop));
|
||||
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
|
||||
storage_params p;
|
||||
p.path = test_path;
|
||||
p.files = &fs;
|
||||
|
@ -307,7 +308,7 @@ void test_remove(std::string const& test_path, bool unbuffered)
|
|||
std::vector<char> buf;
|
||||
file_pool fp;
|
||||
io_service ios;
|
||||
disk_buffer_pool dp(16 * 1024, ios, boost::bind(&nop));
|
||||
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
|
||||
|
||||
aux::session_settings set;
|
||||
set.set_int(settings_pack::disk_io_write_mode
|
||||
|
@ -380,7 +381,7 @@ void test_rename(std::string const& test_path)
|
|||
std::vector<char> buf;
|
||||
file_pool fp;
|
||||
io_service ios;
|
||||
disk_buffer_pool dp(16 * 1024, ios, boost::bind(&nop));
|
||||
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
|
||||
aux::session_settings set;
|
||||
|
||||
boost::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, test_path
|
||||
|
@ -456,7 +457,7 @@ void test_check_files(std::string const& test_path
|
|||
counters cnt;
|
||||
disk_io_thread io(ios, cnt, NULL);
|
||||
io.set_num_threads(1);
|
||||
disk_buffer_pool dp(16 * 1024, ios, boost::bind(&nop));
|
||||
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
|
||||
storage_params p;
|
||||
p.files = &fs;
|
||||
p.path = test_path;
|
||||
|
@ -471,7 +472,7 @@ void test_check_files(std::string const& test_path
|
|||
add_torrent_params frd;
|
||||
std::vector<std::string> links;
|
||||
io.async_check_files(pm.get(), &frd, links
|
||||
, boost::bind(&on_check_resume_data, _1, &done));
|
||||
, std::bind(&on_check_resume_data, _1, &done));
|
||||
io.submit_jobs();
|
||||
ios.reset();
|
||||
run_until(ios, done);
|
||||
|
@ -1285,7 +1286,7 @@ TORRENT_TEST(move_storage_into_self)
|
|||
std::vector<char> buf;
|
||||
file_pool fp;
|
||||
io_service ios;
|
||||
disk_buffer_pool dp(16 * 1024, ios, boost::bind(&nop));
|
||||
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
|
||||
boost::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, save_path, set);
|
||||
|
||||
file::iovec_t const b = {&buf[0], 4};
|
||||
|
@ -1331,7 +1332,7 @@ TORRENT_TEST(dont_move_intermingled_files)
|
|||
std::vector<char> buf;
|
||||
file_pool fp;
|
||||
io_service ios;
|
||||
disk_buffer_pool dp(16 * 1024, ios, boost::bind(&nop));
|
||||
disk_buffer_pool dp(16 * 1024, ios, std::bind(&nop));
|
||||
boost::shared_ptr<default_storage> s = setup_torrent(fs, fp, buf, save_path, set);
|
||||
|
||||
file::iovec_t b = {&buf[0], 4};
|
||||
|
|
|
@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <atomic>
|
||||
#include <list>
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/time.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
|
||||
using namespace libtorrent;
|
||||
|
|
|
@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "test_utils.hpp"
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
|
|
@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include <fstream>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/smart_ptr.hpp>
|
||||
#include <iostream>
|
||||
|
|
|
@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/time.hpp"
|
||||
#include "libtorrent/file.hpp"
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <functional>
|
||||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
|
|
|
@ -234,6 +234,7 @@ char upnp_xml2[] =
|
|||
"</root>";
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
void parser_callback(std::string& out, int token, char const* s, int len
|
||||
, char const* val, int val_len)
|
||||
|
@ -267,7 +268,7 @@ void parser_callback(std::string& out, int token, char const* s, int len
|
|||
void test_parse(char const* in, char const* expected)
|
||||
{
|
||||
std::string out;
|
||||
xml_parse(in, in + strlen(in), boost::bind(&parser_callback
|
||||
xml_parse(in, in + strlen(in), std::bind(&parser_callback
|
||||
, boost::ref(out), _1, _2, _3, _4, _5));
|
||||
std::fprintf(stderr, "in: %s\n out: %s\nexpected: %s\n"
|
||||
, in, out.c_str(), expected);
|
||||
|
@ -278,7 +279,7 @@ TORRENT_TEST(upnp_parser1)
|
|||
{
|
||||
parse_state xml_s;
|
||||
xml_parse(upnp_xml, upnp_xml + sizeof(upnp_xml)
|
||||
, boost::bind(&find_control_url, _1, _2, _3, boost::ref(xml_s)));
|
||||
, std::bind(&find_control_url, _1, _2, _3, boost::ref(xml_s)));
|
||||
|
||||
std::cerr << "namespace " << xml_s.service_type << std::endl;
|
||||
std::cerr << "url_base: " << xml_s.url_base << std::endl;
|
||||
|
@ -293,7 +294,7 @@ TORRENT_TEST(upnp_parser2)
|
|||
{
|
||||
parse_state xml_s;
|
||||
xml_parse(upnp_xml2, upnp_xml2 + sizeof(upnp_xml2)
|
||||
, boost::bind(&find_control_url, _1, _2, _3, boost::ref(xml_s)));
|
||||
, std::bind(&find_control_url, _1, _2, _3, boost::ref(xml_s)));
|
||||
|
||||
std::cerr << "namespace " << xml_s.service_type << std::endl;
|
||||
std::cerr << "url_base: " << xml_s.url_base << std::endl;
|
||||
|
|
|
@ -45,15 +45,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/detail/atomic_count.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#if defined TORRENT_DEBUG && TORRENT_USE_IOSTREAM
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
|
||||
struct udp_tracker
|
||||
{
|
||||
|
@ -141,7 +138,7 @@ struct udp_tracker
|
|||
|
||||
m_socket.async_receive_from(
|
||||
boost::asio::buffer(buffer, size), *from, 0
|
||||
, boost::bind(&udp_tracker::on_udp_receive, this, _1, _2, from, buffer, size));
|
||||
, std::bind(&udp_tracker::on_udp_receive, this, _1, _2, from, buffer, size));
|
||||
}
|
||||
|
||||
udp_tracker()
|
||||
|
@ -185,7 +182,7 @@ struct udp_tracker
|
|||
|
||||
~udp_tracker()
|
||||
{
|
||||
m_ios.post(boost::bind(&udp_tracker::stop, this));
|
||||
m_ios.post(std::bind(&udp_tracker::stop, this));
|
||||
if (m_thread) m_thread->join();
|
||||
}
|
||||
|
||||
|
@ -208,7 +205,7 @@ struct udp_tracker
|
|||
udp::endpoint from;
|
||||
m_socket.async_receive_from(
|
||||
boost::asio::buffer(buffer, int(sizeof(buffer))), from, 0
|
||||
, boost::bind(&udp_tracker::on_udp_receive, this, _1, _2, &from, &buffer[0], int(sizeof(buffer))));
|
||||
, std::bind(&udp_tracker::on_udp_receive, this, _1, _2, &from, &buffer[0], int(sizeof(buffer))));
|
||||
|
||||
m_ios.run(ec);
|
||||
|
||||
|
|
|
@ -38,11 +38,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/kademlia/item.hpp" // for sign_mutable_item
|
||||
#include "libtorrent/ed25519.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <functional>
|
||||
#include <cstdio> // for snprintf
|
||||
#include <cinttypes> // for PRId64 et.al.
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace std::placeholders;
|
||||
namespace lt = libtorrent;
|
||||
|
||||
#ifdef TORRENT_DISABLE_DHT
|
||||
|
@ -93,7 +95,7 @@ alert* wait_for_alert(lt::session& s, int alert_type)
|
|||
static int spinner = 0;
|
||||
static const char anim[] = {'-', '\\', '|', '/'};
|
||||
std::printf("\r%c", anim[spinner]);
|
||||
fflush(stdout);
|
||||
std::fflush(stdout);
|
||||
spinner = (spinner + 1) & 3;
|
||||
//print some alerts?
|
||||
continue;
|
||||
|
@ -133,7 +135,7 @@ void bootstrap(lt::session& s)
|
|||
|
||||
int dump_key(char *filename)
|
||||
{
|
||||
FILE* f = fopen(filename, "rb+");
|
||||
FILE* f = std::fopen(filename, "rb+");
|
||||
if (f == NULL)
|
||||
{
|
||||
std::fprintf(stderr, "failed to open file \"%s\": (%d) %s\n"
|
||||
|
@ -148,7 +150,7 @@ int dump_key(char *filename)
|
|||
std::fprintf(stderr, "invalid key file.\n");
|
||||
return 1;
|
||||
}
|
||||
fclose(f);
|
||||
std::fclose(f);
|
||||
|
||||
std::array<char, 32> public_key;
|
||||
std::array<char, 64> private_key;
|
||||
|
@ -167,7 +169,7 @@ int generate_key(char* filename)
|
|||
unsigned char seed[32];
|
||||
ed25519_create_seed(seed);
|
||||
|
||||
FILE* f = fopen(filename, "wb+");
|
||||
FILE* f = std::fopen(filename, "wb+");
|
||||
if (f == NULL)
|
||||
{
|
||||
std::fprintf(stderr, "failed to open file for writing \"%s\": (%d) %s\n"
|
||||
|
@ -175,20 +177,20 @@ int generate_key(char* filename)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int size = int(fwrite(seed, 1, 32, f));
|
||||
int size = int(std::fwrite(seed, 1, 32, f));
|
||||
if (size != 32)
|
||||
{
|
||||
std::fprintf(stderr, "failed to write key file.\n");
|
||||
return 1;
|
||||
}
|
||||
fclose(f);
|
||||
std::fclose(f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void load_dht_state(lt::session& s)
|
||||
{
|
||||
FILE* f = fopen(".dht", "rb");
|
||||
FILE* f = std::fopen(".dht", "rb");
|
||||
if (f == NULL) return;
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
|
@ -213,7 +215,7 @@ void load_dht_state(lt::session& s)
|
|||
s.load_state(e);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
std::fclose(f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,14 +225,14 @@ int save_dht_state(lt::session& s)
|
|||
s.save_state(e, session::save_dht_state);
|
||||
std::vector<char> state;
|
||||
bencode(std::back_inserter(state), e);
|
||||
FILE* f = fopen(".dht", "wb+");
|
||||
FILE* f = std::fopen(".dht", "wb+");
|
||||
if (f == NULL)
|
||||
{
|
||||
std::fprintf(stderr, "failed to open file .dht for writing");
|
||||
return 1;
|
||||
}
|
||||
fwrite(&state[0], 1, state.size(), f);
|
||||
fclose(f);
|
||||
std::fwrite(&state[0], 1, state.size(), f);
|
||||
std::fclose(f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -317,7 +319,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
bootstrap(s);
|
||||
sha1_hash target = s.dht_put_item(data);
|
||||
|
||||
|
||||
std::printf("PUT %s\n", to_hex(target.to_string()).c_str());
|
||||
|
||||
alert* a = wait_for_alert(s, dht_put_alert::alert_type);
|
||||
|
@ -330,7 +332,7 @@ int main(int argc, char* argv[])
|
|||
--argc;
|
||||
if (argc < 1) usage();
|
||||
|
||||
FILE* f = fopen(argv[0], "rb+");
|
||||
FILE* f = std::fopen(argv[0], "rb+");
|
||||
if (f == NULL)
|
||||
{
|
||||
std::fprintf(stderr, "failed to open file \"%s\": (%d) %s\n"
|
||||
|
@ -340,7 +342,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
unsigned char seed[32];
|
||||
fread(seed, 1, 32, f);
|
||||
fclose(f);
|
||||
std::fclose(f);
|
||||
|
||||
++argv;
|
||||
--argc;
|
||||
|
@ -350,9 +352,9 @@ int main(int argc, char* argv[])
|
|||
std::array<char, 64> private_key;
|
||||
ed25519_create_keypair((unsigned char*)public_key.data()
|
||||
, (unsigned char*)private_key.data(), seed);
|
||||
|
||||
|
||||
bootstrap(s);
|
||||
s.dht_put_item(public_key, boost::bind(&put_string, _1, _2, _3, _4
|
||||
s.dht_put_item(public_key, std::bind(&put_string, _1, _2, _3, _4
|
||||
, public_key.data(), private_key.data(), argv[0]));
|
||||
|
||||
std::printf("MPUT publick key: %s\n", to_hex(std::string(public_key.data()
|
||||
|
|
|
@ -32,15 +32,16 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <string>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/random/mersenne_twister.hpp>
|
||||
#include <boost/random/uniform_int_distribution.hpp>
|
||||
#include <random>
|
||||
#include <cinttypes> // for PRId64 et.al.
|
||||
|
||||
#include "libtorrent/bdecode.hpp"
|
||||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
|
||||
using libtorrent::bdecode_node;
|
||||
using boost::random::mt19937;
|
||||
using boost::random::uniform_int_distribution;
|
||||
using std::mt19937;
|
||||
using std::uniform_int_distribution;
|
||||
|
||||
char const* invalid_utf8_sequences[] =
|
||||
{
|
||||
|
|
|
@ -33,12 +33,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
#include <cstring>
|
||||
#include <boost/bind.hpp>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <cstdlib>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <map>
|
||||
#include <cstdio>
|
||||
#include <cinttypes> // for PRId64 et.al.
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace libtorrent::detail; // for write_* and read_*
|
||||
|
@ -61,7 +61,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
if (argc != 2) print_usage();
|
||||
|
||||
FILE* log_file = fopen(argv[1], "r");
|
||||
FILE* log_file = std::fopen(argv[1], "r");
|
||||
if (log_file == 0)
|
||||
{
|
||||
std::fprintf(stderr, "failed to open logfile: %s\n%d: %s\n"
|
||||
|
@ -69,11 +69,11 @@ int main(int argc, char* argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
FILE* writes_file = fopen("writes.log", "w+");
|
||||
FILE* reads_file = fopen("reads.log", "w+");
|
||||
FILE* writes_file = std::fopen("writes.log", "w+");
|
||||
FILE* reads_file = std::fopen("reads.log", "w+");
|
||||
|
||||
FILE* writes_elev_file = fopen("writes_elevator.log", "w+");
|
||||
FILE* reads_elev_file = fopen("reads_elevator.log", "w+");
|
||||
FILE* writes_elev_file = std::fopen("writes_elevator.log", "w+");
|
||||
FILE* reads_elev_file = std::fopen("reads_elevator.log", "w+");
|
||||
|
||||
|
||||
typedef std::map<boost::uint32_t, file_op> op_map;
|
||||
|
@ -147,13 +147,13 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
fclose(writes_file);
|
||||
fclose(reads_file);
|
||||
fclose(writes_elev_file);
|
||||
fclose(reads_elev_file);
|
||||
fclose(log_file);
|
||||
std::fclose(writes_file);
|
||||
std::fclose(reads_file);
|
||||
std::fclose(writes_elev_file);
|
||||
std::fclose(reads_elev_file);
|
||||
std::fclose(log_file);
|
||||
|
||||
FILE* gnuplot = fopen("file_access.gnuplot", "w+");
|
||||
FILE* gnuplot = std::fopen("file_access.gnuplot", "w+");
|
||||
|
||||
char const* gnuplot_file =
|
||||
"set term png size 1400,1024\n"
|
||||
|
@ -167,8 +167,8 @@ int main(int argc, char* argv[])
|
|||
"plot \"writes.log\" using 1:2:3:(0) title \"writes\" with vectors arrowstyle 1, "
|
||||
"\"reads.log\" using 1:2:3:(0) title \"reads\" with vectors arrowstyle 2\n";
|
||||
|
||||
fwrite(gnuplot_file, strlen(gnuplot_file), 1, gnuplot);
|
||||
fclose(gnuplot);
|
||||
std::fwrite(gnuplot_file, strlen(gnuplot_file), 1, gnuplot);
|
||||
std::fclose(gnuplot);
|
||||
|
||||
system("gnuplot file_access.gnuplot");
|
||||
|
||||
|
|
Loading…
Reference in New Issue