don't pull in the asio namespace in libtorrent. refer to it by boost::asio

This commit is contained in:
arvidn 2015-06-06 01:22:53 -04:00
parent 1668e1c59c
commit 389ffc622c
39 changed files with 290 additions and 291 deletions

View File

@ -74,13 +74,13 @@ network primitives
==================
There are a few typedefs in the ``libtorrent`` namespace which pulls
in network types from the ``asio`` namespace. These are::
in network types from the ``boost::asio`` namespace. These are::
typedef asio::ip::address address;
typedef asio::ip::address_v4 address_v4;
typedef asio::ip::address_v6 address_v6;
using asio::ip::tcp;
using asio::ip::udp;
typedef boost::asio::ip::address address;
typedef boost::asio::ip::address_v4 address_v4;
typedef boost::asio::ip::address_v6 address_v6;
using boost::asio::ip::tcp;
using boost::asio::ip::udp;
These are declared in the ``<libtorrent/socket.hpp>`` header.

View File

@ -691,7 +691,7 @@ namespace libtorrent
#ifdef TORRENT_USE_OPENSSL
// this is a generic SSL context used when talking to
// unauthenticated HTTPS servers
asio::ssl::context m_ssl_ctx;
boost::asio::ssl::context m_ssl_ctx;
#endif
// handles delayed alerts

View File

@ -68,7 +68,7 @@ struct http_connection;
struct resolver_interface;
const int default_max_bottled_buffer_size = 2*1024*1024;
typedef boost::function<void(error_code const&
, http_parser const&, char const* data, int size, http_connection&)> http_handler;
@ -128,7 +128,7 @@ struct TORRENT_EXTRA_EXPORT http_connection
socket_type const& socket() const { return m_sock; }
std::vector<tcp::endpoint> const& endpoints() const { return m_endpoints; }
private:
#if TORRENT_USE_I2P
@ -158,7 +158,7 @@ private:
socket_type m_sock;
#ifdef TORRENT_USE_OPENSSL
asio::ssl::context* m_ssl_ctx;
boost::asio::ssl::context* m_ssl_ctx;
bool m_own_ssl_context;
#endif
@ -182,7 +182,7 @@ private:
time_point m_last_receive;
time_point m_start_time;
// specifies whether or not the connection is
// configured to use a proxy
proxy_settings m_proxy;

View File

@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#ifdef __OBJC__
#ifdef __OBJC__
#undef Protocol
#endif

View File

@ -57,11 +57,11 @@ namespace libtorrent
job_type_t type;
// used for write jobs
std::vector<asio::const_buffer> const* vec;
std::vector<boost::asio::const_buffer> const* vec;
// used for read jobs
char* recv_buf;
int buf_size;
boost::array<asio::mutable_buffer, 2> read_vec;
boost::array<boost::asio::mutable_buffer, 2> read_vec;
boost::shared_ptr<peer_connection> peer;
// defined in session_impl.cpp

View File

@ -86,7 +86,7 @@ namespace libtorrent
struct encryption_handler
{
int encrypt(std::vector<asio::mutable_buffer>& iovec);
int encrypt(std::vector<boost::asio::mutable_buffer>& iovec);
int decrypt(crypto_receive_buffer& recv_buffer, std::size_t& bytes_transferred);
bool switch_send_crypto(boost::shared_ptr<crypto_plugin> crypto

View File

@ -213,7 +213,7 @@ public:
endpoint_type remote_endpoint(error_code& ec) const
{
if (!m_sock.is_open()) ec = asio::error::not_connected;
if (!m_sock.is_open()) ec = boost::asio::error::not_connected;
return m_remote_endpoint;
}
@ -245,7 +245,7 @@ public:
}
bool is_open() const { return m_sock.is_open(); }
protected:
bool handle_error(error_code const& e, boost::shared_ptr<handler_type> const& h);

View File

@ -89,8 +89,6 @@ namespace libtorrent
typedef boost::asio::ip::tcp::socket stream_socket;
typedef boost::asio::ip::udp::socket datagram_socket;
typedef boost::asio::ip::tcp::acceptor socket_acceptor;
namespace asio = boost::asio;
#endif
#if TORRENT_USE_IPV6

View File

@ -61,12 +61,12 @@ class ssl_stream
{
public:
explicit ssl_stream(io_service& io_service, asio::ssl::context& ctx)
explicit ssl_stream(io_service& io_service, boost::asio::ssl::context& ctx)
: m_sock(io_service, ctx)
{
}
typedef typename asio::ssl::stream<Stream> sock_type;
typedef typename boost::asio::ssl::stream<Stream> sock_type;
typedef typename sock_type::next_layer_type next_layer_type;
typedef typename Stream::lowest_layer_type lowest_layer_type;
typedef typename Stream::endpoint_type endpoint_type;
@ -109,14 +109,14 @@ public:
{
// this is used for accepting SSL connections
boost::shared_ptr<handler_type> h(new handler_type(handler));
m_sock.async_handshake(asio::ssl::stream_base::server
m_sock.async_handshake(boost::asio::ssl::stream_base::server
, boost::bind(&ssl_stream::handshake, this, _1, h));
}
void accept_handshake(error_code& ec)
{
// this is used for accepting SSL connections
m_sock.handshake(asio::ssl::stream_base::server, ec);
m_sock.handshake(boost::asio::ssl::stream_base::server, ec);
}
template <class Handler>
@ -289,7 +289,7 @@ public:
{
return m_sock.lowest_layer();
}
next_layer_type& next_layer()
{
return m_sock.next_layer();
@ -305,7 +305,7 @@ private:
return;
}
m_sock.async_handshake(asio::ssl::stream_base::client
m_sock.async_handshake(boost::asio::ssl::stream_base::client
, boost::bind(&ssl_stream::handshake, this, _1, h));
}
@ -314,7 +314,7 @@ private:
(*h)(e);
}
asio::ssl::stream<Stream> m_sock;
boost::asio::ssl::stream<Stream> m_sock;
};
}

View File

@ -100,7 +100,7 @@ namespace libtorrent {
TORRENT_DEPRECATED
time_point time_now_hires();
inline time_point time_now()
inline time_point time_now()
{ return clock_type::now(); }
inline time_point time_now_hires()

View File

@ -1230,7 +1230,7 @@ namespace libtorrent
boost::shared_ptr<piece_manager> m_storage;
#ifdef TORRENT_USE_OPENSSL
boost::shared_ptr<asio::ssl::context> m_ssl_ctx;
boost::shared_ptr<boost::asio::ssl::context> m_ssl_ctx;
#if BOOST_VERSION >= 104700
bool verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx);

View File

@ -63,6 +63,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/deadline_timer.hpp"
#include "libtorrent/union_endpoint.hpp"
#include "libtorrent/udp_socket.hpp" // for udp_socket_observer
#include "libtorrent/io_service.hpp"
namespace libtorrent
{

View File

@ -210,7 +210,7 @@ namespace libtorrent
void wrap(char const* hostname, int port, char const* p, int len, error_code& ec);
void unwrap(error_code const& e, char const* buf, int size);
udp::socket m_ipv4_sock;
datagram_socket m_ipv4_sock;
deadline_timer m_timer;
int m_buf_size;
@ -223,7 +223,7 @@ namespace libtorrent
char* m_buf;
#if TORRENT_USE_IPV6
udp::socket m_ipv6_sock;
datagram_socket m_ipv6_sock;
#endif
boost::uint16_t m_bind_port;
@ -232,7 +232,7 @@ namespace libtorrent
boost::uint8_t m_v6_outstanding;
#endif
tcp::socket m_socks5_sock;
stream_socket m_socks5_sock;
proxy_settings m_proxy_settings;
tcp::resolver m_resolver;
char m_tmp_buf[270];

View File

@ -179,7 +179,7 @@ public:
typedef stream_socket::endpoint_type endpoint_type;
typedef stream_socket::protocol_type protocol_type;
explicit utp_stream(asio::io_service& io_service);
explicit utp_stream(io_service& io_service);
~utp_stream();
lowest_layer_type& lowest_layer() { return *this; }
@ -221,7 +221,7 @@ public:
error_code cancel(error_code&)
{
cancel_handlers(asio::error::operation_aborted);
cancel_handlers(boost::asio::error::operation_aborted);
return error_code();
}
@ -246,7 +246,7 @@ public:
void add_write_buffer(void const* buf, size_t len);
void issue_write();
size_t read_some(bool clear_buffers);
int send_delay() const;
int recv_delay() const;
@ -271,20 +271,20 @@ public:
std::size_t available() const;
std::size_t available(error_code& /*ec*/) const { return available(); }
asio::io_service& get_io_service() { return m_io_service; }
io_service& get_io_service() { return m_io_service; }
template <class Handler>
void async_connect(endpoint_type const& endpoint, Handler const& handler)
{
if (!endpoint.address().is_v4())
{
m_io_service.post(boost::bind<void>(handler, asio::error::operation_not_supported, 0));
m_io_service.post(boost::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
return;
}
if (m_impl == 0)
{
m_io_service.post(boost::bind<void>(handler, asio::error::not_connected, 0));
m_io_service.post(boost::bind<void>(handler, boost::asio::error::not_connected, 0));
return;
}
@ -297,14 +297,14 @@ public:
{
if (m_impl == 0)
{
m_io_service.post(boost::bind<void>(handler, asio::error::not_connected, 0));
m_io_service.post(boost::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, asio::error::operation_not_supported, 0));
m_io_service.post(boost::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
return;
}
int bytes_added = 0;
@ -312,8 +312,8 @@ public:
, end(buffers.end()); i != end; ++i)
{
if (buffer_size(*i) == 0) continue;
using asio::buffer_cast;
using asio::buffer_size;
using boost::asio::buffer_cast;
using boost::asio::buffer_size;
add_read_buffer(buffer_cast<void*>(*i), buffer_size(*i));
bytes_added += buffer_size(*i);
}
@ -334,7 +334,7 @@ public:
{
if (m_impl == 0)
{
m_io_service.post(boost::bind<void>(handler, asio::error::not_connected, 0));
m_io_service.post(boost::bind<void>(handler, boost::asio::error::not_connected, 0));
return;
}
@ -342,7 +342,7 @@ public:
if (m_read_handler)
{
TORRENT_ASSERT(false); // we should never do this!
m_io_service.post(boost::bind<void>(handler, asio::error::operation_not_supported, 0));
m_io_service.post(boost::bind<void>(handler, boost::asio::error::operation_not_supported, 0));
return;
}
m_read_handler = handler;
@ -366,13 +366,13 @@ public:
TORRENT_ASSERT(!m_read_handler);
if (m_impl == 0)
{
ec = asio::error::not_connected;
ec = boost::asio::error::not_connected;
return 0;
}
if (read_buffer_size() == 0)
{
ec = asio::error::would_block;
ec = boost::asio::error::would_block;
return 0;
}
#if TORRENT_USE_ASSERTS
@ -382,8 +382,8 @@ public:
for (typename Mutable_Buffers::const_iterator i = buffers.begin()
, end(buffers.end()); i != end; ++i)
{
using asio::buffer_cast;
using asio::buffer_size;
using boost::asio::buffer_cast;
using boost::asio::buffer_size;
add_read_buffer(buffer_cast<void*>(*i), buffer_size(*i));
#if TORRENT_USE_ASSERTS
buf_size += buffer_size(*i);
@ -431,7 +431,7 @@ public:
if (m_impl == 0)
{
m_io_service.post(boost::bind<void>(handler
, asio::error::not_connected, 0));
, boost::asio::error::not_connected, 0));
return;
}
@ -439,7 +439,7 @@ public:
if (m_write_handler)
{
m_io_service.post(boost::bind<void>(handler
, asio::error::operation_not_supported, 0));
, boost::asio::error::operation_not_supported, 0));
return;
}
@ -448,8 +448,8 @@ public:
, end(buffers.end()); i != end; ++i)
{
if (buffer_size(*i) == 0) continue;
using asio::buffer_cast;
using asio::buffer_size;
using boost::asio::buffer_cast;
using boost::asio::buffer_size;
add_write_buffer((void*)buffer_cast<void const*>(*i), buffer_size(*i));
bytes_added += buffer_size(*i);
}
@ -474,7 +474,7 @@ private:
boost::function2<void, error_code const&, std::size_t> m_read_handler;
boost::function2<void, error_code const&, std::size_t> m_write_handler;
asio::io_service& m_io_service;
io_service& m_io_service;
utp_socket_impl* m_impl;
boost::uint16_t m_incoming_close_reason;

View File

@ -209,7 +209,7 @@ namespace libtorrent
{
TORRENT_ASSERT(is_multicast(m_multicast_endpoint.address()));
using namespace asio::ip::multicast;
using namespace boost::asio::ip::multicast;
}
void broadcast_socket::open(receive_handler_t const& handler
@ -271,7 +271,7 @@ namespace libtorrent
void broadcast_socket::open_multicast_socket(io_service& ios
, address const& addr, bool loopback, error_code& ec)
{
using namespace asio::ip::multicast;
using namespace boost::asio::ip::multicast;
boost::shared_ptr<datagram_socket> s(new datagram_socket(ios));
s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec);
@ -291,7 +291,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("broadcast_socket::on_receive");
#endif
s->async_receive_from(asio::buffer(se.buffer, sizeof(se.buffer))
s->async_receive_from(boost::asio::buffer(se.buffer, sizeof(se.buffer))
, se.remote, boost::bind(&broadcast_socket::on_receive, this, &se, _1, _2));
++m_outstanding_operations;
}
@ -299,7 +299,7 @@ namespace libtorrent
void broadcast_socket::open_unicast_socket(io_service& ios, address const& addr
, address_v4 const& mask)
{
using namespace asio::ip::multicast;
using namespace boost::asio::ip::multicast;
error_code ec;
boost::shared_ptr<datagram_socket> s(new datagram_socket(ios));
s->open(addr.is_v4() ? udp::v4() : udp::v6(), ec);
@ -311,14 +311,14 @@ namespace libtorrent
socket_entry& se = m_unicast_sockets.back();
// allow sending broadcast messages
asio::socket_base::broadcast option(true);
boost::asio::socket_base::broadcast option(true);
s->set_option(option, ec);
if (!ec) se.broadcast = true;
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("broadcast_socket::on_receive");
#endif
s->async_receive_from(asio::buffer(se.buffer, sizeof(se.buffer))
s->async_receive_from(boost::asio::buffer(se.buffer, sizeof(se.buffer))
, se.remote, boost::bind(&broadcast_socket::on_receive, this, &se, _1, _2));
++m_outstanding_operations;
}
@ -332,12 +332,12 @@ namespace libtorrent
, end(m_unicast_sockets.end()); i != end; ++i)
{
if (!i->socket) continue;
i->socket->send_to(asio::buffer(buffer, size), m_multicast_endpoint, 0, e);
i->socket->send_to(boost::asio::buffer(buffer, size), m_multicast_endpoint, 0, e);
// if the user specified the broadcast flag, send one to the broadcast
// address as well
if ((flags & broadcast_socket::broadcast) && i->can_broadcast())
i->socket->send_to(asio::buffer(buffer, size)
i->socket->send_to(boost::asio::buffer(buffer, size)
, udp::endpoint(i->broadcast_address(), m_multicast_endpoint.port()), 0, e);
if (e)
@ -355,7 +355,7 @@ namespace libtorrent
, end(m_sockets.end()); i != end; ++i)
{
if (!i->socket) continue;
i->socket->send_to(asio::buffer(buffer, size), m_multicast_endpoint, 0, e);
i->socket->send_to(boost::asio::buffer(buffer, size), m_multicast_endpoint, 0, e);
if (e)
{
i->socket->close(e);
@ -391,7 +391,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("broadcast_socket::on_receive");
#endif
s->socket->async_receive_from(asio::buffer(s->buffer, sizeof(s->buffer))
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));
++m_outstanding_operations;
}

View File

@ -1997,7 +1997,7 @@ namespace libtorrent
if (m_num_threads == 0)
{
j->error.ec = asio::error::operation_aborted;
j->error.ec = boost::asio::error::operation_aborted;
if (handler) handler(j);
free_job(j);
return;

View File

@ -98,7 +98,7 @@ namespace libtorrent { namespace
address inaddr_to_address(in_addr const* ina, int len = 4)
{
typedef asio::ip::address_v4::bytes_type bytes_t;
typedef boost::asio::ip::address_v4::bytes_type bytes_t;
bytes_t b;
std::memset(&b[0], 0, b.size());
if (len > 0) std::memcpy(&b[0], ina, (std::min)(len, int(b.size())));
@ -108,7 +108,7 @@ namespace libtorrent { namespace
#if TORRENT_USE_IPV6
address inaddr6_to_address(in6_addr const* ina6, int len = 16)
{
typedef asio::ip::address_v6::bytes_type bytes_t;
typedef boost::asio::ip::address_v6::bytes_type bytes_t;
bytes_t b;
std::memset(&b[0], 0, b.size());
if (len > 0) std::memcpy(&b[0], ina6, (std::min)(len, int(b.size())));
@ -363,7 +363,7 @@ namespace libtorrent
{
if (family == AF_INET)
{
typedef asio::ip::address_v4::bytes_type bytes_t;
typedef boost::asio::ip::address_v4::bytes_type bytes_t;
bytes_t b;
std::memset(&b[0], 0xff, b.size());
for (int i = sizeof(bytes_t)/8-1; i > 0; --i)
@ -381,7 +381,7 @@ namespace libtorrent
#if TORRENT_USE_IPV6
else if (family == AF_INET6)
{
typedef asio::ip::address_v6::bytes_type bytes_t;
typedef boost::asio::ip::address_v6::bytes_type bytes_t;
bytes_t b;
std::memset(&b[0], 0xff, b.size());
for (int i = sizeof(bytes_t)/8-1; i > 0; --i)
@ -412,14 +412,14 @@ namespace libtorrent
int s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
return ret;
}
ifaddrs *ifaddr;
if (getifaddrs(&ifaddr) == -1)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
close(s);
return ret;
}
@ -459,7 +459,7 @@ namespace libtorrent
int s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
return ret;
}
ifconf ifc;
@ -469,7 +469,7 @@ namespace libtorrent
ifc.ifc_buf = (char*)buf;
if (ioctl(s, SIOCGIFCONF, &ifc) < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
close(s);
return ret;
}
@ -507,7 +507,7 @@ namespace libtorrent
strncpy(req.ifr_name, item.ifr_name, IF_NAMESIZE - 1);
if (ioctl(s, SIOCGIFMTU, &req) < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
close(s);
return ret;
}
@ -530,7 +530,7 @@ namespace libtorrent
else
#endif
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
close(s);
return ret;
}
@ -567,7 +567,7 @@ namespace libtorrent
| GAA_FLAG_SKIP_ANYCAST, NULL, adapter_addresses, &out_buf_size) != ERROR_BUFFER_OVERFLOW)
{
FreeLibrary(iphlp);
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_interface>();
}
@ -575,7 +575,7 @@ namespace libtorrent
if (!adapter_addresses)
{
FreeLibrary(iphlp);
ec = asio::error::no_memory;
ec = boost::asio::error::no_memory;
return std::vector<ip_interface>();
}
@ -613,7 +613,7 @@ namespace libtorrent
SOCKET s = socket(AF_INET, SOCK_DGRAM, 0);
if (s == SOCKET_ERROR)
{
ec = error_code(WSAGetLastError(), asio::error::system_category);
ec = error_code(WSAGetLastError(), boost::asio::error::system_category);
return ret;
}
@ -623,7 +623,7 @@ namespace libtorrent
if (WSAIoctl(s, SIO_GET_INTERFACE_LIST, 0, 0, buffer,
sizeof(buffer), &size, 0, 0) != 0)
{
ec = error_code(WSAGetLastError(), asio::error::system_category);
ec = error_code(WSAGetLastError(), boost::asio::error::system_category);
closesocket(s);
return ret;
}
@ -653,7 +653,7 @@ namespace libtorrent
// make a best guess of the interface we're using and its IP
udp::resolver r(ios);
udp::resolver::iterator i = r.resolve(udp::resolver::query(asio::ip::host_name(ec), "0"), ec);
udp::resolver::iterator i = r.resolve(udp::resolver::query(boost::asio::ip::host_name(ec), "0"), ec);
if (ec) return ret;
ip_interface iface;
for (;i != udp::resolver_iterator(); ++i)
@ -707,20 +707,20 @@ namespace libtorrent
int s = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC);
if (s == -1)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
return std::vector<ip_route>();
}
int n = write(s, &m, len);
if (n == -1)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
close(s);
return std::vector<ip_route>();
}
else if (n != len)
{
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
close(s);
return std::vector<ip_route>();
}
@ -729,7 +729,7 @@ namespace libtorrent
n = read(s, &m, len);
if (n == -1)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
close(s);
return std::vector<ip_route>();
}
@ -740,31 +740,31 @@ namespace libtorrent
std::cout << " rtm_type: " << ptr->rtm_type << std::endl;
if (ptr->rtm_errno)
{
ec = error_code(ptr->rtm_errno, asio::error::system_category);
ec = error_code(ptr->rtm_errno, boost::asio::error::system_category);
return std::vector<ip_route>();
}
if (m.m_rtm.rtm_flags & RTF_UP == 0
|| m.m_rtm.rtm_flags & RTF_GATEWAY == 0)
{
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return address_v4::any();
}
if (ptr->rtm_addrs & RTA_DST == 0
|| ptr->rtm_addrs & RTA_GATEWAY == 0
|| ptr->rtm_addrs & RTA_NETMASK == 0)
{
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
if (ptr->rtm_msglen > len - ((char*)ptr - ((char*)&m.m_rtm)))
{
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
int min_len = sizeof(rt_msghdr) + 2 * sizeof(sockaddr_in);
if (m.m_rtm.rtm_msglen < min_len)
{
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
@ -796,7 +796,7 @@ namespace libtorrent
if (sysctl(mib, 6, 0, &needed, 0, 0) < 0)
#endif
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
return std::vector<ip_route>();
}
@ -808,7 +808,7 @@ namespace libtorrent
boost::scoped_array<char> buf(new (std::nothrow) char[needed]);
if (buf.get() == 0)
{
ec = asio::error::no_memory;
ec = boost::asio::error::no_memory;
return std::vector<ip_route>();
}
@ -818,7 +818,7 @@ namespace libtorrent
if (sysctl(mib, 6, buf.get(), &needed, 0, 0) < 0)
#endif
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
return std::vector<ip_route>();
}
@ -827,7 +827,7 @@ namespace libtorrent
int s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
return std::vector<ip_route>();
}
rt_msghdr* rtm;
@ -849,7 +849,7 @@ namespace libtorrent
HMODULE iphlp = LoadLibraryA("Iphlpapi.dll");
if (!iphlp)
{
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
@ -859,7 +859,7 @@ namespace libtorrent
if (!GetAdaptersInfo)
{
FreeLibrary(iphlp);
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
@ -868,7 +868,7 @@ namespace libtorrent
if (GetAdaptersInfo(adapter_info, &out_buf_size) != ERROR_BUFFER_OVERFLOW)
{
FreeLibrary(iphlp);
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
@ -876,7 +876,7 @@ namespace libtorrent
if (!adapter_info)
{
FreeLibrary(iphlp);
ec = asio::error::no_memory;
ec = boost::asio::error::no_memory;
return std::vector<ip_route>();
}
@ -910,7 +910,7 @@ namespace libtorrent
HMODULE iphlp = LoadLibraryA("Iphlpapi.dll");
if (!iphlp)
{
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
@ -918,7 +918,7 @@ namespace libtorrent
GetIfEntry_t GetIfEntry = (GetIfEntry_t)GetProcAddress(iphlp, "GetIfEntry");
if (!GetIfEntry)
{
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
@ -969,7 +969,7 @@ namespace libtorrent
if (!GetIpForwardTable)
{
FreeLibrary(iphlp);
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
@ -978,7 +978,7 @@ namespace libtorrent
if (GetIpForwardTable(routes, &out_buf_size, FALSE) != ERROR_INSUFFICIENT_BUFFER)
{
FreeLibrary(iphlp);
ec = asio::error::operation_not_supported;
ec = boost::asio::error::operation_not_supported;
return std::vector<ip_route>();
}
@ -986,7 +986,7 @@ namespace libtorrent
if (!routes)
{
FreeLibrary(iphlp);
ec = asio::error::no_memory;
ec = boost::asio::error::no_memory;
return std::vector<ip_route>();
}
@ -1019,7 +1019,7 @@ namespace libtorrent
int sock = socket(PF_ROUTE, SOCK_DGRAM, NETLINK_ROUTE);
if (sock < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
return std::vector<ip_route>();
}
@ -1037,7 +1037,7 @@ namespace libtorrent
if (send(sock, nl_msg, nl_msg->nlmsg_len, 0) < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
close(sock);
return std::vector<ip_route>();
}
@ -1045,7 +1045,7 @@ namespace libtorrent
int len = read_nl_sock(sock, msg, BUFSIZE, seq, getpid());
if (len < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
close(sock);
return std::vector<ip_route>();
}
@ -1053,7 +1053,7 @@ namespace libtorrent
int s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
{
ec = error_code(errno, asio::error::system_category);
ec = error_code(errno, boost::asio::error::system_category);
return std::vector<ip_route>();
}
for (; NLMSG_OK(nl_msg, len); nl_msg = NLMSG_NEXT(nl_msg, len))

View File

@ -268,7 +268,7 @@ void http_connection::start(std::string const& hostname, int port
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("http_connection::on_write");
#endif
async_write(m_sock, asio::buffer(m_sendbuffer)
async_write(m_sock, boost::asio::buffer(m_sendbuffer)
, boost::bind(&http_connection::on_write, me, _1));
}
else
@ -331,12 +331,12 @@ void http_connection::start(std::string const& hostname, int port
if (m_ssl_ctx == 0)
{
m_ssl_ctx = new (std::nothrow) boost::asio::ssl::context(
m_timer.get_io_service(), asio::ssl::context::sslv23_client);
m_timer.get_io_service(), boost::asio::ssl::context::sslv23_client);
if (m_ssl_ctx)
{
m_own_ssl_context = true;
error_code ec;
m_ssl_ctx->set_verify_mode(asio::ssl::context::verify_none, ec);
m_ssl_ctx->set_verify_mode(boost::asio::ssl::context::verify_none, ec);
TORRENT_ASSERT(!ec);
}
}
@ -411,7 +411,7 @@ void http_connection::on_timeout(boost::weak_ptr<http_connection> p
boost::shared_ptr<http_connection> c = p.lock();
if (!c) return;
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
if (c->m_abort) return;
@ -431,7 +431,7 @@ void http_connection::on_timeout(boost::weak_ptr<http_connection> p
}
else
{
c->callback(asio::error::timed_out);
c->callback(boost::asio::error::timed_out);
c->close(true);
return;
}
@ -601,12 +601,12 @@ void http_connection::on_connect(error_code const& e)
m_last_receive = clock_type::now();
m_start_time = m_last_receive;
if (!e)
{
{
if (m_connect_handler) m_connect_handler(*this);
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("http_connection::on_write");
#endif
async_write(m_sock, asio::buffer(m_sendbuffer)
async_write(m_sock, boost::asio::buffer(m_sendbuffer)
, boost::bind(&http_connection::on_write, shared_from_this(), _1));
}
else if (!m_endpoints.empty() && !m_abort)
@ -615,9 +615,9 @@ void http_connection::on_connect(error_code const& e)
error_code ec;
m_sock.close(ec);
connect();
}
}
else
{
{
boost::shared_ptr<http_connection> me(shared_from_this());
callback(e);
close();
@ -666,7 +666,7 @@ void http_connection::on_write(error_code const& e)
complete_async("http_connection::on_write");
#endif
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
if (e)
{
@ -700,7 +700,7 @@ void http_connection::on_write(error_code const& e)
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("http_connection::on_read");
#endif
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
m_sock.async_read_some(boost::asio::buffer(&m_recvbuffer[0] + m_read_pos
, amount_to_read)
, boost::bind(&http_connection::on_read
, shared_from_this(), _1, _2));
@ -719,7 +719,7 @@ void http_connection::on_read(error_code const& e
TORRENT_ASSERT(m_download_quota >= 0);
}
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
if (m_abort) return;
@ -729,9 +729,9 @@ void http_connection::on_read(error_code const& e
// when using the asio SSL wrapper, it seems like
// we get the shut_down error instead of EOF
if (e == asio::error::eof || e == asio::error::shut_down)
if (e == boost::asio::error::eof || e == boost::asio::error::shut_down)
{
error_code ec = asio::error::eof;
error_code ec = boost::asio::error::eof;
TORRENT_ASSERT(bytes_transferred == 0);
char* data = 0;
std::size_t size = 0;
@ -861,7 +861,7 @@ void http_connection::on_read(error_code const& e
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("http_connection::on_read");
#endif
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
m_sock.async_read_some(boost::asio::buffer(&m_recvbuffer[0] + m_read_pos
, amount_to_read)
, boost::bind(&http_connection::on_read
, me, _1, _2));
@ -872,11 +872,11 @@ void http_connection::on_assign_bandwidth(error_code const& e)
#if defined TORRENT_ASIO_DEBUGGING
complete_async("http_connection::on_assign_bandwidth");
#endif
if ((e == asio::error::operation_aborted
if ((e == boost::asio::error::operation_aborted
&& m_limiter_timer_active)
|| !m_sock.is_open())
{
callback(asio::error::eof);
callback(boost::asio::error::eof);
return;
}
m_limiter_timer_active = false;
@ -895,7 +895,7 @@ void http_connection::on_assign_bandwidth(error_code const& e)
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("http_connection::on_read");
#endif
m_sock.async_read_some(asio::buffer(&m_recvbuffer[0] + m_read_pos
m_sock.async_read_some(boost::asio::buffer(&m_recvbuffer[0] + m_read_pos
, amount_to_read)
, boost::bind(&http_connection::on_read
, shared_from_this(), _1, _2));

View File

@ -77,7 +77,7 @@ namespace libtorrent
m_user + ":" + m_password) + "\r\n", p);
}
write_string("\r\n", p);
async_write(m_sock, asio::buffer(m_buffer)
async_write(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&http_stream::handshake1, this, _1, h));
}
@ -87,7 +87,7 @@ namespace libtorrent
// read one byte from the socket
m_buffer.resize(1);
async_read(m_sock, asio::buffer(m_buffer)
async_read(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&http_stream::handshake2, this, _1, h));
}
@ -120,7 +120,7 @@ namespace libtorrent
char* status = std::strchr(&m_buffer[0], ' ');
if (status == 0)
{
(*h)(asio::error::operation_not_supported);
(*h)(boost::asio::error::operation_not_supported);
error_code ec;
close(ec);
return;
@ -130,7 +130,7 @@ namespace libtorrent
int code = std::atoi(status);
if (code != 200)
{
(*h)(asio::error::operation_not_supported);
(*h)(boost::asio::error::operation_not_supported);
error_code ec;
close(ec);
return;
@ -143,7 +143,7 @@ namespace libtorrent
// read another byte from the socket
m_buffer.resize(read_pos + 1);
async_read(m_sock, asio::buffer(&m_buffer[0] + read_pos, 1)
async_read(m_sock, boost::asio::buffer(&m_buffer[0] + read_pos, 1)
, boost::bind(&http_stream::handshake2, this, _1, h));
}

View File

@ -293,7 +293,7 @@ namespace libtorrent
// keep this alive
boost::shared_ptr<http_tracker_connection> me(shared_from_this());
if (ec && ec != asio::error::eof)
if (ec && ec != boost::asio::error::eof)
{
fail(ec);
return;
@ -301,7 +301,7 @@ namespace libtorrent
if (!parser.header_finished())
{
fail(asio::error::eof);
fail(boost::asio::error::eof);
return;
}
@ -312,7 +312,7 @@ namespace libtorrent
return;
}
if (ec && ec != asio::error::eof)
if (ec && ec != boost::asio::error::eof)
{
fail(ec, parser.status_code());
return;

View File

@ -269,7 +269,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("i2p_stream::start_read_line");
#endif
async_write(m_sock, asio::buffer(cmd, sizeof(cmd) - 1)
async_write(m_sock, boost::asio::buffer(cmd, sizeof(cmd) - 1)
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
// fprintf(stderr, ">>> %s", cmd);
}
@ -286,7 +286,7 @@ namespace libtorrent
add_outstanding_async("i2p_stream::read_line");
#endif
m_buffer.resize(1);
async_read(m_sock, asio::buffer(m_buffer)
async_read(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&i2p_stream::read_line, this, _1, h));
}
@ -308,7 +308,7 @@ namespace libtorrent
#endif
// read another byte from the socket
m_buffer.resize(read_pos + 1);
async_read(m_sock, asio::buffer(&m_buffer[read_pos], 1)
async_read(m_sock, boost::asio::buffer(&m_buffer[read_pos], 1)
, boost::bind(&i2p_stream::read_line, this, _1, h));
return;
}
@ -456,7 +456,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("i2p_stream::read_line");
#endif
async_read(m_sock, asio::buffer(m_buffer)
async_read(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&i2p_stream::read_line, this, _1, h));
break;
}
@ -475,7 +475,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("i2p_stream::start_read_line");
#endif
async_write(m_sock, asio::buffer(cmd, size)
async_write(m_sock, boost::asio::buffer(cmd, size)
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
}
@ -489,7 +489,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("i2p_stream::start_read_line");
#endif
async_write(m_sock, asio::buffer(cmd, size)
async_write(m_sock, boost::asio::buffer(cmd, size)
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
}
@ -504,7 +504,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("i2p_stream::start_read_line");
#endif
async_write(m_sock, asio::buffer(cmd, size)
async_write(m_sock, boost::asio::buffer(cmd, size)
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
}
@ -518,7 +518,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("i2p_stream::start_read_line");
#endif
async_write(m_sock, asio::buffer(cmd, size)
async_write(m_sock, boost::asio::buffer(cmd, size)
, boost::bind(&i2p_stream::start_read_line, this, _1, h));
}
}

View File

@ -310,9 +310,9 @@ namespace libtorrent { namespace dht
{
if (ec)
{
if (ec == asio::error::connection_refused
|| ec == asio::error::connection_reset
|| ec == asio::error::connection_aborted
if (ec == boost::asio::error::connection_refused
|| ec == boost::asio::error::connection_reset
|| ec == boost::asio::error::connection_aborted
#ifdef WIN32
|| ec == error_code(ERROR_HOST_UNREACHABLE, system_category())
|| ec == error_code(ERROR_PORT_UNREACHABLE, system_category())

View File

@ -126,7 +126,7 @@ void natpmp::start()
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("natpmp::on_reply");
#endif
m_socket.async_receive_from(asio::buffer(&m_response_buffer, 16)
m_socket.async_receive_from(boost::asio::buffer(&m_response_buffer, 16)
, m_remote, boost::bind(&natpmp::on_reply, self(), _1, _2));
send_get_ip_address_request(l);
@ -152,7 +152,7 @@ void natpmp::send_get_ip_address_request(mutex::scoped_lock& l)
log("==> get public IP address", l);
error_code ec;
m_socket.send_to(asio::buffer(buf, sizeof(buf)), m_nat_endpoint, 0, ec);
m_socket.send_to(boost::asio::buffer(buf, sizeof(buf)), m_nat_endpoint, 0, ec);
}
bool natpmp::get_mapping(int index, int& local_port, int& external_port, int& protocol) const
@ -360,7 +360,7 @@ void natpmp::send_map_request(int i, mutex::scoped_lock& l)
log(msg, l);
error_code ec;
m_socket.send_to(asio::buffer(buf, sizeof(buf)), m_nat_endpoint, 0, ec);
m_socket.send_to(boost::asio::buffer(buf, sizeof(buf)), m_nat_endpoint, 0, ec);
m.map_sent = true;
m.outstanding_request = true;
if (m_abort)
@ -434,7 +434,7 @@ void natpmp::on_reply(error_code const& e
char msg_buf[16];
memcpy(msg_buf, m_response_buffer, bytes_transferred);
m_socket.async_receive_from(asio::buffer(&m_response_buffer, 16)
m_socket.async_receive_from(boost::asio::buffer(&m_response_buffer, 16)
, m_remote, boost::bind(&natpmp::on_reply, self(), _1, _2));
// simulate packet loss

View File

@ -137,7 +137,7 @@ namespace libtorrent
return 0;
}
int encryption_handler::encrypt(std::vector<asio::mutable_buffer>& iovec)
int encryption_handler::encrypt(std::vector<boost::asio::mutable_buffer>& iovec)
{
TORRENT_ASSERT(!m_send_barriers.empty());
TORRENT_ASSERT(m_send_barriers.front().enc_handler);
@ -146,7 +146,7 @@ namespace libtorrent
if (to_process != INT_MAX)
{
for (std::vector<asio::mutable_buffer>::iterator i = iovec.begin();
for (std::vector<boost::asio::mutable_buffer>::iterator i = iovec.begin();
to_process >= 0; ++i)
{
if (to_process == 0)
@ -154,23 +154,23 @@ namespace libtorrent
iovec.erase(i, iovec.end());
break;
}
else if (to_process < asio::buffer_size(*i))
else if (to_process < boost::asio::buffer_size(*i))
{
*i = asio::mutable_buffer(asio::buffer_cast<void*>(*i), to_process);
*i = boost::asio::mutable_buffer(boost::asio::buffer_cast<void*>(*i), to_process);
iovec.erase(++i, iovec.end());
to_process = 0;
break;
}
to_process -= asio::buffer_size(*i);
to_process -= boost::asio::buffer_size(*i);
}
TORRENT_ASSERT(to_process == 0);
}
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
to_process = 0;
for (std::vector<asio::mutable_buffer>::iterator i = iovec.begin();
for (std::vector<boost::asio::mutable_buffer>::iterator i = iovec.begin();
i != iovec.end(); ++i)
to_process += asio::buffer_size(*i);
to_process += boost::asio::buffer_size(*i);
#endif
int next_barrier = 0;
@ -188,9 +188,9 @@ namespace libtorrent
if (next_barrier != INT_MAX)
{
int overhead = 0;
for (std::vector<asio::mutable_buffer>::iterator i = iovec.begin();
for (std::vector<boost::asio::mutable_buffer>::iterator i = iovec.begin();
i != iovec.end(); ++i)
overhead += asio::buffer_size(*i);
overhead += boost::asio::buffer_size(*i);
TORRENT_ASSERT(overhead + to_process == next_barrier);
}
#endif
@ -208,7 +208,7 @@ namespace libtorrent
int consume = 0;
if (recv_buffer.crypto_packet_finished())
{
std::vector<asio::mutable_buffer> wr_buf;
std::vector<boost::asio::mutable_buffer> wr_buf;
recv_buffer.mutable_buffers(wr_buf, bytes_transferred);
int packet_size = 0;
int produce = bytes_transferred;
@ -255,7 +255,7 @@ namespace libtorrent
{
int consume = 0;
int produce = 0;
std::vector<asio::mutable_buffer> wr_buf;
std::vector<boost::asio::mutable_buffer> wr_buf;
crypto->decrypt(wr_buf, consume, produce, packet_size);
TORRENT_ASSERT(wr_buf.empty());
TORRENT_ASSERT(consume == 0);

View File

@ -57,7 +57,7 @@ namespace libtorrent
h(ec, empty);
return;
}
dns_cache_entry& ce = m_cache[hostname];
time_point now = aux::time_now();
ce.last_seen = now;
@ -86,7 +86,6 @@ namespace libtorrent
m_cache.erase(oldest);
}
}
void resolver::async_resolve(std::string const& host, int flags
, resolver_interface::callback_t const& h)
@ -103,7 +102,7 @@ namespace libtorrent
return;
}
}
// the port is ignored
tcp::resolver::query q(host, "80");

View File

@ -344,7 +344,7 @@ void feed::on_feed(error_code const& ec
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
if (ec && ec != asio::error::eof)
if (ec && ec != boost::asio::error::eof)
{
++m_failures;
m_error = ec;

View File

@ -96,7 +96,7 @@ namespace libtorrent
// of the certificate
#define CASE(t) case socket_type_int_impl<ssl_stream<t> >::value: \
s.get<ssl_stream<t> >()->set_verify_callback( \
asio::ssl::rfc2818_verification(hostname), ec); \
boost::asio::ssl::rfc2818_verification(hostname), ec); \
ctx = SSL_get_SSL_CTX(s.get<ssl_stream<t> >()->native_handle()); \
break;

View File

@ -131,7 +131,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("socks5_stream::handshake1");
#endif
async_write(m_sock, asio::buffer(m_buffer)
async_write(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&socks5_stream::handshake1, this, _1, h));
}
else if (m_version == 4)
@ -157,7 +157,7 @@ namespace libtorrent
add_outstanding_async("socks5_stream::handshake2");
#endif
m_buffer.resize(2);
async_read(m_sock, asio::buffer(m_buffer)
async_read(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&socks5_stream::handshake2, this, _1, h));
}
@ -208,7 +208,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("socks5_stream::handshake3");
#endif
async_write(m_sock, asio::buffer(m_buffer)
async_write(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&socks5_stream::handshake3, this, _1, h));
}
else
@ -232,7 +232,7 @@ namespace libtorrent
add_outstanding_async("socks5_stream::handshake4");
#endif
m_buffer.resize(2);
async_read(m_sock, asio::buffer(m_buffer)
async_read(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&socks5_stream::handshake4, this, _1, h));
}
@ -334,7 +334,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("socks5_stream::connect1");
#endif
async_write(m_sock, asio::buffer(m_buffer)
async_write(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&socks5_stream::connect1, this, _1, h));
}
@ -353,7 +353,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("socks5_stream::connect2");
#endif
async_read(m_sock, asio::buffer(m_buffer)
async_read(m_sock, boost::asio::buffer(m_buffer)
, boost::bind(&socks5_stream::connect2, this, _1, h));
}
@ -385,13 +385,13 @@ namespace libtorrent
error_code ec(socks_error::general_failure, get_socks_category());
switch (response)
{
case 2: ec = asio::error::no_permission; break;
case 3: ec = asio::error::network_unreachable; break;
case 4: ec = asio::error::host_unreachable; break;
case 5: ec = asio::error::connection_refused; break;
case 6: ec = asio::error::timed_out; break;
case 2: ec = boost::asio::error::no_permission; break;
case 3: ec = boost::asio::error::network_unreachable; break;
case 4: ec = boost::asio::error::host_unreachable; break;
case 5: ec = boost::asio::error::connection_refused; break;
case 6: ec = boost::asio::error::timed_out; break;
case 7: ec = socks_error::command_not_supported; break;
case 8: ec = asio::error::address_family_not_supported; break;
case 8: ec = boost::asio::error::address_family_not_supported; break;
}
(*h)(ec);
close(ec);
@ -436,7 +436,7 @@ namespace libtorrent
}
else
{
(*h)(asio::error::address_family_not_supported);
(*h)(boost::asio::error::address_family_not_supported);
error_code ec;
close(ec);
return;
@ -447,7 +447,7 @@ namespace libtorrent
add_outstanding_async("socks5_stream::connect3");
#endif
TORRENT_ASSERT(extra_bytes > 0);
async_read(m_sock, asio::buffer(&m_buffer[m_buffer.size() - extra_bytes], extra_bytes)
async_read(m_sock, boost::asio::buffer(&m_buffer[m_buffer.size() - extra_bytes], extra_bytes)
, boost::bind(&socks5_stream::connect3, this, _1, h));
}
else if (m_version == 4)

View File

@ -57,7 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
using namespace libtorrent;
udp_socket::udp_socket(asio::io_service& ios)
udp_socket::udp_socket(io_service& ios)
: m_observers_locked(false)
, m_ipv4_sock(ios)
, m_timer(ios)
@ -209,10 +209,10 @@ void udp_socket::send(udp::endpoint const& ep, char const* p, int len
#if TORRENT_USE_IPV6
if (ep.address().is_v6() && m_ipv6_sock.is_open())
m_ipv6_sock.send_to(asio::buffer(p, len), ep, 0, ec);
m_ipv6_sock.send_to(boost::asio::buffer(p, len), ep, 0, ec);
else
#endif
m_ipv4_sock.send_to(asio::buffer(p, len), ep, 0, ec);
m_ipv4_sock.send_to(boost::asio::buffer(p, len), ep, 0, ec);
if (ec == error::would_block || ec == error::try_again)
{
@ -221,7 +221,7 @@ void udp_socket::send(udp::endpoint const& ep, char const* p, int len
{
if (!m_v6_write_subscribed)
{
m_ipv6_sock.async_send(asio::null_buffers()
m_ipv6_sock.async_send(boost::asio::null_buffers()
, boost::bind(&udp_socket::on_writable, this, _1, &m_ipv6_sock));
m_v6_write_subscribed = true;
}
@ -231,7 +231,7 @@ void udp_socket::send(udp::endpoint const& ep, char const* p, int len
{
if (!m_v4_write_subscribed)
{
m_ipv4_sock.async_send(asio::null_buffers()
m_ipv4_sock.async_send(boost::asio::null_buffers()
, boost::bind(&udp_socket::on_writable, this, _1, &m_ipv4_sock));
m_v4_write_subscribed = true;
}
@ -248,7 +248,7 @@ void udp_socket::on_writable(error_code const& ec, udp::socket* s)
#endif
m_v4_write_subscribed = false;
if (ec == asio::error::operation_aborted) return;
if (ec == boost::asio::error::operation_aborted) return;
call_writable_handler();
}
@ -276,7 +276,7 @@ void udp_socket::on_read(error_code const& ec, udp::socket* s)
--m_v4_outstanding;
}
if (ec == asio::error::operation_aborted) return;
if (ec == boost::asio::error::operation_aborted) return;
if (m_abort) return;
CHECK_MAGIC;
@ -285,7 +285,7 @@ void udp_socket::on_read(error_code const& ec, udp::socket* s)
{
error_code ec;
udp::endpoint ep;
size_t bytes_transferred = s->receive_from(asio::buffer(m_buf, m_buf_size), ep, 0, ec);
size_t bytes_transferred = s->receive_from(boost::asio::buffer(m_buf, m_buf_size), ep, 0, ec);
// TODO: it would be nice to detect this on posix systems also
#ifdef TORRENT_WINDOWS
@ -301,7 +301,7 @@ void udp_socket::on_read(error_code const& ec, udp::socket* s)
}
#endif
if (ec == asio::error::would_block || ec == asio::error::try_again) break;
if (ec == boost::asio::error::would_block || ec == boost::asio::error::try_again) break;
on_read_impl(ep, ec, bytes_transferred);
}
call_drained_handler();
@ -430,14 +430,14 @@ void udp_socket::on_read_impl(udp::endpoint const& ep
call_handler(e, ep, 0, 0);
// don't stop listening on recoverable errors
if (e != asio::error::host_unreachable
&& e != asio::error::fault
&& e != asio::error::connection_reset
&& e != asio::error::connection_refused
&& e != asio::error::connection_aborted
&& e != asio::error::operation_aborted
&& e != asio::error::network_reset
&& e != asio::error::network_unreachable
if (e != boost::asio::error::host_unreachable
&& e != boost::asio::error::fault
&& e != boost::asio::error::connection_reset
&& e != boost::asio::error::connection_refused
&& e != boost::asio::error::connection_aborted
&& e != boost::asio::error::operation_aborted
&& e != boost::asio::error::network_reset
&& e != boost::asio::error::network_unreachable
#ifdef WIN32
// ERROR_MORE_DATA means the same thing as EMSGSIZE
&& e != error_code(ERROR_MORE_DATA, system_category())
@ -448,7 +448,7 @@ void udp_socket::on_read_impl(udp::endpoint const& ep
&& e != error_code(ERROR_CONNECTION_REFUSED, system_category())
&& e != error_code(ERROR_CONNECTION_ABORTED, system_category())
#endif
&& e != asio::error::message_size)
&& e != boost::asio::error::message_size)
{
return;
}
@ -492,7 +492,7 @@ void udp_socket::setup_read(udp::socket* s)
udp::endpoint ep;
TORRENT_TRY
{
s->async_receive_from(asio::null_buffers()
s->async_receive_from(boost::asio::null_buffers()
, ep, boost::bind(&udp_socket::on_read, this, _1, s));
}
TORRENT_CATCH(boost::system::system_error& e)
@ -520,9 +520,9 @@ void udp_socket::wrap(udp::endpoint const& ep, char const* p, int len, error_cod
write_uint8(ep.address().is_v4()?1:4, h); // atyp
write_endpoint(ep, h);
boost::array<asio::const_buffer, 2> iovec;
iovec[0] = asio::const_buffer(header, h - header);
iovec[1] = asio::const_buffer(p, len);
boost::array<boost::asio::const_buffer, 2> iovec;
iovec[0] = boost::asio::const_buffer(header, h - header);
iovec[1] = boost::asio::const_buffer(p, len);
#if TORRENT_USE_IPV6
if (m_udp_proxy_addr.address().is_v4() && m_ipv4_sock.is_open())
@ -551,9 +551,9 @@ void udp_socket::wrap(char const* hostname, int port, char const* p, int len, er
h += hostlen;
write_uint16(port, h);
boost::array<asio::const_buffer, 2> iovec;
iovec[0] = asio::const_buffer(header, h - header);
iovec[1] = asio::const_buffer(p, len);
boost::array<boost::asio::const_buffer, 2> iovec;
iovec[0] = boost::asio::const_buffer(header, h - header);
iovec[1] = boost::asio::const_buffer(p, len);
#if TORRENT_USE_IPV6
if (m_udp_proxy_addr.address().is_v6() && m_ipv6_sock.is_open())
@ -810,7 +810,7 @@ void udp_socket::on_name_lookup(error_code const& e, tcp::resolver::iterator i)
if (m_abort) return;
CHECK_MAGIC;
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
TORRENT_ASSERT(is_single_thread());
@ -917,7 +917,7 @@ void udp_socket::on_connected(error_code const& e)
m_timer.cancel();
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
if (m_abort) return;
@ -952,7 +952,7 @@ void udp_socket::on_connected(error_code const& e)
#if TORRENT_USE_ASSERTS
++m_outstanding_socks;
#endif
asio::async_write(m_socks5_sock, asio::buffer(m_tmp_buf, p - m_tmp_buf)
boost::asio::async_write(m_socks5_sock, boost::asio::buffer(m_tmp_buf, p - m_tmp_buf)
, boost::bind(&udp_socket::handshake1, this, _1));
}
@ -988,7 +988,7 @@ void udp_socket::handshake1(error_code const& e)
#if TORRENT_USE_ASSERTS
++m_outstanding_socks;
#endif
asio::async_read(m_socks5_sock, asio::buffer(m_tmp_buf, 2)
boost::asio::async_read(m_socks5_sock, boost::asio::buffer(m_tmp_buf, 2)
, boost::bind(&udp_socket::handshake2, this, _1));
}
@ -1061,7 +1061,7 @@ void udp_socket::handshake2(error_code const& e)
#if TORRENT_USE_ASSERTS
++m_outstanding_socks;
#endif
asio::async_write(m_socks5_sock, asio::buffer(m_tmp_buf, p - m_tmp_buf)
boost::asio::async_write(m_socks5_sock, boost::asio::buffer(m_tmp_buf, p - m_tmp_buf)
, boost::bind(&udp_socket::handshake3, this, _1));
}
else
@ -1105,7 +1105,7 @@ void udp_socket::handshake3(error_code const& e)
#if TORRENT_USE_ASSERTS
++m_outstanding_socks;
#endif
asio::async_read(m_socks5_sock, asio::buffer(m_tmp_buf, 2)
boost::asio::async_read(m_socks5_sock, boost::asio::buffer(m_tmp_buf, 2)
, boost::bind(&udp_socket::handshake4, this, _1));
}
@ -1171,7 +1171,7 @@ void udp_socket::socks_forward_udp()
#if TORRENT_USE_ASSERTS
++m_outstanding_socks;
#endif
asio::async_write(m_socks5_sock, asio::buffer(m_tmp_buf, p - m_tmp_buf)
boost::asio::async_write(m_socks5_sock, boost::asio::buffer(m_tmp_buf, p - m_tmp_buf)
, boost::bind(&udp_socket::connect1, this, _1));
}
@ -1207,7 +1207,7 @@ void udp_socket::connect1(error_code const& e)
#if TORRENT_USE_ASSERTS
++m_outstanding_socks;
#endif
asio::async_read(m_socks5_sock, asio::buffer(m_tmp_buf, 10)
boost::asio::async_read(m_socks5_sock, boost::asio::buffer(m_tmp_buf, 10)
, boost::bind(&udp_socket::connect2, this, _1));
}
@ -1278,7 +1278,7 @@ void udp_socket::connect2(error_code const& e)
#if TORRENT_USE_ASSERTS
++m_outstanding_socks;
#endif
asio::async_read(m_socks5_sock, asio::buffer(m_tmp_buf, 10)
boost::asio::async_read(m_socks5_sock, boost::asio::buffer(m_tmp_buf, 10)
, boost::bind(&udp_socket::hung_up, this, _1));
}
@ -1301,7 +1301,7 @@ void udp_socket::hung_up(error_code const& e)
CHECK_MAGIC;
TORRENT_ASSERT(is_single_thread());
if (e == asio::error::operation_aborted || m_abort) return;
if (e == boost::asio::error::operation_aborted || m_abort) return;
// the socks connection was closed, re-open it
set_proxy_settings(m_proxy_settings);

View File

@ -181,7 +181,7 @@ namespace libtorrent
complete_async("udp_tracker_connection::name_lookup");
#endif
if (m_abort) return;
if (error == asio::error::operation_aborted) return;
if (error == boost::asio::error::operation_aborted) return;
if (error || addresses.empty())
{
fail(error);
@ -199,7 +199,7 @@ namespace libtorrent
}
restart_read_timeout();
// look for an address that has the same kind as the one
// we're listening on. To make sure the tracker get our
// correct listening address.

View File

@ -940,7 +940,7 @@ void upnp::on_upnp_xml(error_code const& e
d.upnp_connection.reset();
}
if (e && e != asio::error::eof)
if (e && e != boost::asio::error::eof)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while fetching control url from: %s: %s"
@ -1249,7 +1249,7 @@ void upnp::on_upnp_get_ip_address_response(error_code const& e
if (m_closing) return;
if (e && e != asio::error::eof)
if (e && e != boost::asio::error::eof)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while getting external IP address: %s"
@ -1327,7 +1327,7 @@ void upnp::on_upnp_map_response(error_code const& e
d.upnp_connection.reset();
}
if (e && e != asio::error::eof)
if (e && e != boost::asio::error::eof)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while adding port map: %s"
@ -1495,7 +1495,7 @@ void upnp::on_upnp_unmap_response(error_code const& e
d.upnp_connection.reset();
}
if (e && e != asio::error::eof)
if (e && e != boost::asio::error::eof)
{
char msg[500];
snprintf(msg, sizeof(msg), "error while deleting portmap: %s"

View File

@ -171,7 +171,7 @@ namespace libtorrent
#endif
if (!m_sock.is_open())
{
ec = asio::error::operation_aborted;
ec = boost::asio::error::operation_aborted;
return;
}

View File

@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/random.hpp"
#include "libtorrent/invariant_check.hpp"
#include "libtorrent/performance_counters.hpp"
#include "libtorrent/io_service.hpp"
#include <boost/cstdint.hpp>
#include <limits>
@ -154,7 +155,7 @@ struct packet
// this is also used as a cursor to describe where the
// next payload that hasn't been consumed yet starts
boost::uint16_t header_size;
// the number of times this packet has been sent
boost::uint8_t num_transmissions:6;
@ -298,7 +299,7 @@ struct utp_socket_impl
tcp::endpoint remote_endpoint(error_code& ec) const
{
if (m_state == UTP_STATE_NONE)
ec = asio::error::not_connected;
ec = boost::asio::error::not_connected;
else
TORRENT_ASSERT(m_remote_address != address_v4::any());
return tcp::endpoint(m_remote_address, m_port);
@ -790,7 +791,7 @@ int utp_stream::recv_delay() const
return m_impl ? m_impl->m_recv_delay : 0;
}
utp_stream::utp_stream(asio::io_service& io_service)
utp_stream::utp_stream(io_service& io_service)
: m_io_service(io_service)
, m_impl(0)
, m_incoming_close_reason(0)
@ -834,7 +835,7 @@ utp_stream::endpoint_type utp_stream::remote_endpoint(error_code& ec) const
{
if (!m_impl)
{
ec = asio::error::not_connected;
ec = boost::asio::error::not_connected;
return endpoint_type();
}
return m_impl->remote_endpoint(ec);
@ -844,7 +845,7 @@ utp_stream::endpoint_type utp_stream::local_endpoint(error_code& ec) const
{
if (m_impl == 0 || m_impl->m_sm == 0)
{
ec = asio::error::not_connected;
ec = boost::asio::error::not_connected;
return endpoint_type();
}
return tcp::endpoint(m_impl->m_local_address, m_impl->m_sm->local_port(ec));
@ -1275,7 +1276,7 @@ bool utp_socket_impl::destroy()
if (m_state == UTP_STATE_CONNECTED)
send_fin();
bool cancelled = cancel_handlers(asio::error::operation_aborted, true);
bool cancelled = cancel_handlers(boost::asio::error::operation_aborted, true);
m_userdata = 0;
@ -2801,7 +2802,7 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
return true;
}
UTP_LOGV("%8p: incoming packet type:RESET\n", this);
m_error = asio::error::connection_reset;
m_error = boost::asio::error::connection_reset;
set_state(UTP_STATE_ERROR_WAIT);
test_socket_state();
return true;
@ -3296,14 +3297,14 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
if (!m_attached)
{
UTP_LOGV("%8p: close initiated here, delete socket\n", this);
m_error = asio::error::eof;
m_error = boost::asio::error::eof;
set_state(UTP_STATE_DELETE);
test_socket_state();
}
else
{
UTP_LOGV("%8p: closing socket\n", this);
m_error = asio::error::eof;
m_error = boost::asio::error::eof;
set_state(UTP_STATE_ERROR_WAIT);
test_socket_state();
}
@ -3496,7 +3497,7 @@ void utp_socket_impl::tick(time_point now)
if (m_num_timeouts > m_sm->num_resends())
{
// the connection is dead
m_error = asio::error::timed_out;
m_error = boost::asio::error::timed_out;
set_state(UTP_STATE_ERROR_WAIT);
test_socket_state();
return;
@ -3581,12 +3582,12 @@ void utp_socket_impl::tick(time_point now)
#endif
// the connection is dead
m_error = asio::error::timed_out;
m_error = boost::asio::error::timed_out;
set_state(UTP_STATE_ERROR_WAIT);
test_socket_state();
return;
}
// don't fast-resend this packet
if (m_fast_resend_seq_nr == ((m_acked_seq_nr + 1) & ACK_MASK))
m_fast_resend_seq_nr = (m_fast_resend_seq_nr + 1) & ACK_MASK;
@ -3603,7 +3604,7 @@ void utp_socket_impl::tick(time_point now)
else if (m_state == UTP_STATE_FIN_SENT)
{
// the connection is dead
m_error = asio::error::eof;
m_error = boost::asio::error::eof;
set_state(UTP_STATE_ERROR_WAIT);
test_socket_state();
return;

View File

@ -113,7 +113,7 @@ struct dht_server
void thread_fun()
{
char buffer[2000];
for (;;)
{
error_code ec;
@ -121,7 +121,7 @@ struct dht_server
size_t bytes_transferred;
bool done = false;
m_socket.async_receive_from(
asio::buffer(buffer, sizeof(buffer)), from, 0
boost::asio::buffer(buffer, sizeof(buffer)), from, 0
, boost::bind(&incoming_packet, _1, _2, &bytes_transferred, &ec, &done));
while (!done)
{

View File

@ -77,8 +77,8 @@ int read_message(stream_socket& s, char* buffer, int max_size)
{
using namespace libtorrent::detail;
error_code ec;
libtorrent::asio::read(s, libtorrent::asio::buffer(buffer, 4)
, libtorrent::asio::transfer_all(), ec);
boost::asio::read(s, boost::asio::buffer(buffer, 4)
, boost::asio::transfer_all(), ec);
if (ec)
{
if (ec) TEST_ERROR(ec.message());
@ -93,8 +93,8 @@ int read_message(stream_socket& s, char* buffer, int max_size)
return -1;
}
libtorrent::asio::read(s, libtorrent::asio::buffer(buffer, length)
, libtorrent::asio::transfer_all(), ec);
boost::asio::read(s, boost::asio::buffer(buffer, length)
, boost::asio::transfer_all(), ec);
if (ec)
{
if (ec) TEST_ERROR(ec.message());
@ -159,8 +159,8 @@ void send_allow_fast(stream_socket& s, int piece)
char* ptr = msg + 5;
write_int32(piece, ptr);
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(msg, 9)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(msg, 9)
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -172,8 +172,8 @@ void send_suggest_piece(stream_socket& s, int piece)
char* ptr = msg + 5;
write_int32(piece, ptr);
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(msg, 9)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(msg, 9)
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -182,8 +182,8 @@ void send_keepalive(stream_socket& s)
log("==> keepalive");
char msg[] = "\0\0\0\0";
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(msg, 4)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(msg, 4)
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -192,8 +192,8 @@ void send_unchoke(stream_socket& s)
log("==> unchoke");
char msg[] = "\0\0\0\x01\x01";
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(msg, 5)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(msg, 5)
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -202,8 +202,8 @@ void send_have_all(stream_socket& s)
log("==> have_all");
char msg[] = "\0\0\0\x01\x0e"; // have_all
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(msg, 5)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(msg, 5)
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -212,8 +212,8 @@ void send_have_none(stream_socket& s)
log("==> have_none");
char msg[] = "\0\0\0\x01\x0f"; // have_none
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(msg, 5)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(msg, 5)
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -234,8 +234,8 @@ void send_bitfield(stream_socket& s, char const* bits)
ptr[i/8] |= (bits[i] == '1' ? 1 : 0) << i % 8;
}
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(msg, packet_size)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(msg, packet_size)
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -247,8 +247,8 @@ void do_handshake(stream_socket& s, sha1_hash const& ih, char* buffer)
log("==> handshake");
error_code ec;
std::memcpy(handshake + 28, ih.begin(), 20);
libtorrent::asio::write(s, libtorrent::asio::buffer(handshake, sizeof(handshake) - 1)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(handshake, sizeof(handshake) - 1)
, boost::asio::transfer_all(), ec);
if (ec)
{
TEST_ERROR(ec.message());
@ -256,8 +256,8 @@ void do_handshake(stream_socket& s, sha1_hash const& ih, char* buffer)
}
// read handshake
libtorrent::asio::read(s, libtorrent::asio::buffer(buffer, 68)
, libtorrent::asio::transfer_all(), ec);
boost::asio::read(s, boost::asio::buffer(buffer, 68)
, boost::asio::transfer_all(), ec);
if (ec)
{
TEST_ERROR(ec.message());
@ -271,17 +271,17 @@ void do_handshake(stream_socket& s, sha1_hash const& ih, char* buffer)
char* extensions = buffer + 20;
// check for fast extension support
TEST_CHECK(extensions[7] & 0x4);
#ifndef TORRENT_DISABLE_EXTENSIONS
// check for extension protocol support
TEST_CHECK(extensions[5] & 0x10);
#endif
#ifndef TORRENT_DISABLE_DHT
// check for DHT support
TEST_CHECK(extensions[7] & 0x1);
#endif
TEST_CHECK(std::memcmp(buffer + 28, ih.begin(), 20) == 0);
}
@ -305,8 +305,8 @@ void send_extension_handshake(stream_socket& s, entry const& e)
write_uint8(0, ptr);
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(&buf[0], buf.size())
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(&buf[0], buf.size())
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -357,8 +357,8 @@ void send_ut_metadata_msg(stream_socket& s, int ut_metadata_msg, int type, int p
log("==> ut_metadata [ type: %d piece: %d ]", type, piece);
error_code ec;
libtorrent::asio::write(s, libtorrent::asio::buffer(&buf[0], buf.size())
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(&buf[0], buf.size())
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
}
@ -467,15 +467,15 @@ void test_reject_fast()
recv_buffer[0] = 0x10;
error_code ec;
log("==> reject");
libtorrent::asio::write(s, libtorrent::asio::buffer("\0\0\0\x0d", 4)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer("\0\0\0\x0d", 4)
, boost::asio::transfer_all(), ec);
if (ec)
{
TEST_ERROR(ec.message());
break;
}
libtorrent::asio::write(s, libtorrent::asio::buffer(recv_buffer, 13)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(recv_buffer, 13)
, boost::asio::transfer_all(), ec);
if (ec)
{
TEST_ERROR(ec.message());
@ -503,7 +503,7 @@ void test_respect_suggest()
print_session_log(*ses);
send_have_all(s);
print_session_log(*ses);
std::vector<int> suggested;
suggested.push_back(0);
suggested.push_back(1);
@ -520,7 +520,7 @@ void test_respect_suggest()
send_keepalive(s);
print_session_log(*ses);
int fail_counter = 100;
int fail_counter = 100;
while (!suggested.empty() && fail_counter > 0)
{
print_session_log(*ses);
@ -543,15 +543,15 @@ void test_respect_suggest()
recv_buffer[0] = 0x10;
error_code ec;
log("==> reject");
libtorrent::asio::write(s, libtorrent::asio::buffer("\0\0\0\x0d", 4)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer("\0\0\0\x0d", 4)
, boost::asio::transfer_all(), ec);
if (ec)
{
TEST_ERROR(ec.message());
break;
}
libtorrent::asio::write(s, libtorrent::asio::buffer(recv_buffer, 13)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(recv_buffer, 13)
, boost::asio::transfer_all(), ec);
if (ec)
{
TEST_ERROR(ec.message());
@ -594,7 +594,7 @@ void test_multiple_bitfields()
bitfield[2] = '1';
send_bitfield(s, bitfield.c_str());
print_session_log(*ses);
s.close();
test_sleep(500);
print_session_log(*ses);
@ -623,7 +623,7 @@ void test_multiple_have_all()
print_session_log(*ses);
send_have_all(s);
print_session_log(*ses);
s.close();
print_session_log(*ses);
test_sleep(500);
@ -685,7 +685,7 @@ void test_dont_have()
, ec.message().c_str(), pos);
}
TEST_EQUAL(ret, 0);
log("extension handshake: %s", print_entry(e).c_str());
bdecode_node m = e.dict_find_dict("m");
TEST_CHECK(m);
@ -704,8 +704,8 @@ void test_dont_have()
write_uint8(lt_dont_have, ptr);
write_uint32(3, ptr);
libtorrent::asio::write(s, libtorrent::asio::buffer(recv_buffer, 10)
, libtorrent::asio::transfer_all(), ec);
boost::asio::write(s, boost::asio::buffer(recv_buffer, 10)
, boost::asio::transfer_all(), ec);
if (ec) TEST_ERROR(ec.message());
print_session_log(*ses);

View File

@ -416,7 +416,7 @@ TORRENT_TEST(priority)
p.set_bool(settings_pack::lazy_bitfields, true);
test_transfer(p);
error_code ec;
remove_all("tmp1_priorities", ec);
remove_all("tmp2_priorities", ec);

View File

@ -445,13 +445,13 @@ bool try_connect(libtorrent::session& ses1, int port
name.reserve(40);
for (int i = 0; i < 40; ++i)
name += hex_alphabet[rand() % 16];
fprintf(stderr, "SNI: %s\n", name.c_str());
SSL_set_tlsext_host_name(ssl_sock.native_handle(), name.c_str());
}
fprintf(stderr, "SSL handshake\n");
ssl_sock.handshake(asio::ssl::stream_base::client, ec);
ssl_sock.handshake(boost::asio::ssl::stream_base::client, ec);
print_alerts(ses1, "ses1", true, true, true, &on_alert);
if (ec)
@ -465,7 +465,7 @@ bool try_connect(libtorrent::session& ses1, int port
" " // space for info-hash
"aaaaaaaaaaaaaaaaaaaa" // peer-id
"\0\0\0\x01\x02"; // interested
// fill in the info-hash
if (flags & valid_bittorrent_hash)
{
@ -482,7 +482,7 @@ bool try_connect(libtorrent::session& ses1, int port
std::generate(handshake + 48, handshake + 68, &rand);
fprintf(stderr, "bittorrent handshake\n");
boost::asio::write(ssl_sock, libtorrent::asio::buffer(handshake, (sizeof(handshake) - 1)), ec);
boost::asio::write(ssl_sock, boost::asio::buffer(handshake, (sizeof(handshake) - 1)), ec);
print_alerts(ses1, "ses1", true, true, true, &on_alert);
if (ec)
{
@ -490,10 +490,10 @@ bool try_connect(libtorrent::session& ses1, int port
, ec.message().c_str());
return false;
}
char buf[68];
fprintf(stderr, "read bittorrent handshake\n");
boost::asio::read(ssl_sock, libtorrent::asio::buffer(buf, sizeof(buf)), ec);
boost::asio::read(ssl_sock, boost::asio::buffer(buf, sizeof(buf)), ec);
print_alerts(ses1, "ses1", true, true, true, &on_alert);
if (ec)
{

View File

@ -203,9 +203,9 @@ void run_storage_tests(boost::shared_ptr<torrent_info> info
char* piece = page_aligned_allocator::malloc(piece_size);
{ // avoid having two storages use the same files
{ // avoid having two storages use the same files
file_pool fp;
libtorrent::asio::io_service ios;
boost::asio::io_service ios;
disk_buffer_pool dp(16 * 1024, ios, boost::bind(&nop));
storage_params p;
p.path = test_path;
@ -238,7 +238,7 @@ void run_storage_tests(boost::shared_ptr<torrent_info> info
ret = s->readv(&iov, 1, 0, 3, 0, ec);
if (ret != piece_size - 9) print_error("readv",ret, ec);
TEST_CHECK(std::equal(piece+3, piece + piece_size-9, piece1+3));
// test unaligned read (where the bytes are not aligned)
iov.iov_base = piece;
iov.iov_len = piece_size - 9;
@ -446,7 +446,7 @@ void test_check_files(std::string const& test_path
aux::session_settings set;
file_pool fp;
libtorrent::asio::io_service ios;
boost::asio::io_service ios;
counters cnt;
disk_io_thread io(ios, cnt, NULL);
disk_buffer_pool dp(16 * 1024, ios, boost::bind(&nop));

View File

@ -96,7 +96,7 @@ struct udp_tracker
detail::write_uint32(0, ptr); // action = connect
detail::write_uint32(transaction_id, ptr); // transaction_id
detail::write_uint64(10, ptr); // connection_id
m_socket.send_to(asio::buffer(buffer, 16), *from, 0, e);
m_socket.send_to(boost::asio::buffer(buffer, 16), *from, 0, e);
if (e) fprintf(stderr, "%s: UDP send_to failed. ERROR: %s\n"
, time_now_string(), e.message().c_str());
else fprintf(stderr, "%s: UDP sent response to: %s\n"
@ -115,7 +115,7 @@ struct udp_tracker
detail::write_uint32(1, ptr); // incomplete
detail::write_uint32(1, ptr); // complete
// 0 peers
m_socket.send_to(asio::buffer(buffer, 20), *from, 0, e);
m_socket.send_to(boost::asio::buffer(buffer, 20), *from, 0, e);
if (e) fprintf(stderr, "%s: UDP send_to failed. ERROR: %s\n"
, time_now_string(), e.message().c_str());
else fprintf(stderr, "%s: UDP sent response to: %s\n"
@ -132,7 +132,7 @@ struct udp_tracker
}
m_socket.async_receive_from(
asio::buffer(buffer, size), *from, 0
boost::asio::buffer(buffer, size), *from, 0
, boost::bind(&udp_tracker::on_udp_receive, this, _1, _2, from, buffer, size));
}
@ -192,7 +192,7 @@ struct udp_tracker
error_code ec;
udp::endpoint from;
m_socket.async_receive_from(
asio::buffer(buffer, sizeof(buffer)), from, 0
boost::asio::buffer(buffer, sizeof(buffer)), from, 0
, boost::bind(&udp_tracker::on_udp_receive, this, _1, _2, &from, &buffer[0], sizeof(buffer)));
m_ios.run(ec);