drop support for boost 1.35 and fix some more references to the asio namespace

This commit is contained in:
arvidn 2015-06-06 02:10:53 -04:00
parent 389ffc622c
commit 41533205be
33 changed files with 152 additions and 329 deletions

View File

@ -257,7 +257,7 @@ struct peer_conn
std::memcpy(h + 28, info_hash, 20);
std::generate(h + 48, h + 68, &rand);
// for seeds, don't send the interested message
boost::asio::async_write(s, libtorrent::asio::buffer(h, (sizeof(handshake) - 1) - (seed ? 5 : 0))
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));
}
@ -271,7 +271,7 @@ struct peer_conn
}
// read handshake
boost::asio::async_read(s, libtorrent::asio::buffer((char*)buffer, 68)
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 68)
, boost::bind(&peer_conn::on_handshake2, this, _1, _2));
}
@ -310,7 +310,7 @@ struct peer_conn
write_uint32(1, ptr);
write_uint8(1, ptr);
error_code ec;
boost::asio::async_write(s, libtorrent::asio::buffer(write_buf_proto, ptr - write_buf_proto)
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));
}
else
@ -326,10 +326,9 @@ struct peer_conn
write_uint32(1, ptr);
write_uint8(1, ptr);
error_code ec;
boost::asio::async_write(s, libtorrent::asio::buffer((char*)buffer, len + 10)
boost::asio::async_write(s, boost::asio::buffer((char*)buffer, len + 10)
, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
}
}
void on_have_all_sent(error_code const& ec, size_t bytes_transferred)
@ -341,7 +340,7 @@ struct peer_conn
}
// read message
boost::asio::async_read(s, asio::buffer((char*)buffer, 4)
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 4)
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
}
@ -391,7 +390,7 @@ struct peer_conn
write_uint32(block * 16 * 1024, ptr);
write_uint32(16 * 1024, ptr);
error_code ec;
boost::asio::async_write(s, libtorrent::asio::buffer(m, sizeof(msg) - 1)
boost::asio::async_write(s, boost::asio::buffer(m, sizeof(msg) - 1)
, boost::bind(&peer_conn::on_req_sent, this, m, _1, _2));
++outstanding_requests;
@ -462,7 +461,7 @@ struct peer_conn
}
// read message
boost::asio::async_read(s, asio::buffer((char*)buffer, 4)
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, 4)
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
}
@ -488,7 +487,7 @@ struct peer_conn
close("ERROR RECEIVE MESSAGE PREFIX: packet too big", error_code());
return;
}
boost::asio::async_read(s, asio::buffer((char*)buffer, length)
boost::asio::async_read(s, boost::asio::buffer((char*)buffer, length)
, boost::bind(&peer_conn::on_message, this, _1, _2));
}
@ -540,7 +539,7 @@ struct peer_conn
else
{
// read another message
boost::asio::async_read(s, asio::buffer(buffer, 4)
boost::asio::async_read(s, boost::asio::buffer(buffer, 4)
, boost::bind(&peer_conn::on_msg_length, this, _1, _2));
}
}
@ -697,9 +696,9 @@ struct peer_conn
write_uint8(7, ptr);
write_uint32(piece, ptr);
write_uint32(start, ptr);
boost::array<libtorrent::asio::const_buffer, 2> vec;
vec[0] = libtorrent::asio::buffer(write_buf_proto, ptr - write_buf_proto);
vec[1] = libtorrent::asio::buffer(write_buffer, length);
boost::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));
++blocks_sent;
if (churn && (blocks_sent % churn) == 0 && seed) {
@ -715,7 +714,7 @@ struct peer_conn
write_uint32(5, ptr);
write_uint8(4, ptr);
write_uint32(piece, ptr);
boost::asio::async_write(s, 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), boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
}
};

View File

@ -47,34 +47,22 @@ POSSIBILITY OF SUCH DAMAGE.
#include <winsock2.h>
#endif
#if BOOST_VERSION < 103500
#include <asio/ip/address.hpp>
#else
#include <boost/asio/ip/address.hpp>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#ifdef __OBJC__
#ifdef __OBJC__
#undef Protocol
#endif
namespace libtorrent
{
#if BOOST_VERSION < 103500
typedef ::asio::ip::address address;
typedef ::asio::ip::address_v4 address_v4;
#if TORRENT_USE_IPV6
typedef ::asio::ip::address_v6 address_v6;
#endif
#else
typedef boost::asio::ip::address address;
typedef boost::asio::ip::address_v4 address_v4;
#if TORRENT_USE_IPV6
typedef boost::asio::ip::address_v6 address_v6;
#endif
#endif
}
#endif

View File

@ -159,9 +159,9 @@ namespace libtorrent
void on_receive_impl(std::size_t bytes_transferred);
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
virtual int hit_send_barrier(std::vector<asio::mutable_buffer>& iovec) TORRENT_OVERRIDE;
virtual int hit_send_barrier(std::vector<boost::asio::mutable_buffer>& iovec) TORRENT_OVERRIDE;
#endif
virtual void get_specific_peer_info(peer_info& p) const TORRENT_OVERRIDE;
virtual bool in_handshake() const TORRENT_OVERRIDE;
bool packet_finished() const { return m_recv_buffer.packet_finished(); }

View File

@ -40,11 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/version.hpp>
#if BOOST_VERSION < 103500
#include <asio/buffer.hpp>
#else
#include <boost/asio/buffer.hpp>
#endif
#include <deque>
#include <vector>
#include <string.h> // for memcpy
@ -53,9 +49,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
#if BOOST_VERSION >= 103500
namespace asio = boost::asio;
#endif
struct TORRENT_EXTRA_EXPORT chained_buffer : private single_threaded
{
chained_buffer(): m_bytes(0), m_capacity(0)
@ -109,11 +102,11 @@ namespace libtorrent
// enough room, returns 0
char* allocate_appendix(int s);
std::vector<asio::const_buffer> const& build_iovec(int to_send);
std::vector<boost::asio::const_buffer> const& build_iovec(int to_send);
void clear();
void build_mutable_iovec(int bytes, std::vector<asio::mutable_buffer>& vec);
void build_mutable_iovec(int bytes, std::vector<boost::asio::mutable_buffer>& vec);
~chained_buffer();
@ -136,12 +129,12 @@ namespace libtorrent
// this is the vector of buffers used when
// invoking the async write call
std::vector<asio::const_buffer> m_tmp_vec;
std::vector<boost::asio::const_buffer> m_tmp_vec;
#if TORRENT_USE_ASSERTS
bool m_destructed;
#endif
};
};
}
#endif

View File

@ -41,21 +41,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include <winsock2.h>
#endif
#if BOOST_VERSION < 103500
#include <asio/error.hpp>
#else
#include <boost/asio/error.hpp>
#endif
namespace libtorrent
{
#if BOOST_VERSION < 103500
namespace error = asio::error;
#else
namespace error = boost::asio::error;
#endif
}
#endif

View File

@ -45,11 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <winsock2.h>
#endif
#if BOOST_VERSION < 103500
#include <asio/error_code.hpp>
#else
#include <boost/system/error_code.hpp>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
@ -255,7 +251,7 @@ namespace libtorrent
packet_too_large,
reserved,
// The web server responded with an error
http_error,
// The web server response is missing a location header
@ -319,7 +315,7 @@ namespace libtorrent
no_metadata,
// The peer sent an invalid ``dont_have`` message. The dont have
// message is an extension to allow peers to advertise that the
// no longer has a piece they previously had.
// no longer has a piece they previously had.
invalid_dont_have,
// The peer tried to connect to an SSL torrent without connecting
// over SSL.
@ -402,7 +398,7 @@ namespace libtorrent
// The URL specified an i2p address, but no i2p router is configured
no_i2p_router = 160,
// The tracker URL doesn't support transforming it into a scrape
// URL. i.e. it doesn't contain "announce.
@ -475,31 +471,6 @@ namespace libtorrent
} // namespace errors
#if BOOST_VERSION < 103500
typedef asio::error_code error_code;
// hidden
inline asio::error::error_category posix_category()
{ return asio::error::system_category; }
// hidden
inline asio::error::error_category system_category()
{ return asio::error::system_category; }
// hidden
boost::system::error_category const& get_libtorrent_category()
{
static ::asio::error::error_category libtorrent_category(20);
return libtorrent_category;
}
// hidden
boost::system::error_category const& get_http_category()
{
static ::asio::error::error_category http_category(21);
return http_category;
}
#else
// return the instance of the libtorrent_error_category which
// maps libtorrent error codes to human readable error messages.
TORRENT_EXPORT boost::system::error_category& get_libtorrent_category();
@ -526,7 +497,6 @@ namespace libtorrent
#else
{ return boost::system::generic_category(); }
#endif // BOOST_VERSION < 103600
#endif // BOOST_VERSION < 103500
// internal
inline boost::system::error_category const& generic_category()
@ -602,8 +572,6 @@ namespace libtorrent
}
#if BOOST_VERSION >= 103500
namespace boost { namespace system {
template<> struct is_error_code_enum<libtorrent::errors::error_code_enum>
@ -619,11 +587,5 @@ namespace boost { namespace system {
{ static const bool value = true; };
} }
#endif // BOOST_VERSION
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif

View File

@ -73,11 +73,11 @@ namespace libtorrent
space_exhausted,
// invalid block type (type == 3)
invalid_block_type,
invalid_block_type,
// stored block length did not match one's complement
invalid_stored_block_length,
// dynamic block code description: too many length or distance codes
too_many_length_or_distance_codes,
@ -115,7 +115,6 @@ namespace libtorrent
}
#if BOOST_VERSION >= 103500
namespace boost { namespace system {
template<>
@ -127,7 +126,6 @@ struct is_error_condition_enum<libtorrent::gzip_errors::error_code_enum>
{ static const bool value = true; };
} }
#endif // BOOST_VERSION
#endif

View File

@ -226,7 +226,6 @@ private:
}
#if BOOST_VERSION >= 103500
namespace boost { namespace system {
template<>
@ -238,7 +237,6 @@ struct is_error_condition_enum<libtorrent::i2p_error::i2p_error_code>
{ static const bool value = true; };
} }
#endif // BOOST_VERSION
#endif // TORRENT_USE_I2P

View File

@ -46,11 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <winsock2.h>
#endif
#if BOOST_VERSION < 103500
#include <asio/io_service.hpp>
#else
#include <boost/asio/io_service.hpp>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
@ -60,12 +56,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
#if BOOST_VERSION < 103500
typedef ::asio::io_service io_service;
#else
typedef boost::asio::io_service io_service;
#endif
}
#endif

View File

@ -47,26 +47,13 @@ POSSIBILITY OF SUCH DAMAGE.
#undef Protocol
#endif
#if BOOST_VERSION >= 103500
namespace boost {
#endif
namespace asio {
class io_service;
}
#if BOOST_VERSION >= 103500
}
#endif
namespace boost { namespace asio {
class io_service;
}}
namespace libtorrent
{
#if BOOST_VERSION < 103500
typedef ::asio::io_service io_service;
#else
typedef boost::asio::io_service io_service;
#endif
}
#endif

View File

@ -35,11 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include <libtorrent/kademlia/node_id.hpp>
#if BOOST_VERSION < 103500
#include <asio/ip/udp.hpp>
#else
#include <boost/asio/ip/udp.hpp>
#endif
namespace libtorrent {

View File

@ -745,19 +745,19 @@ namespace libtorrent
virtual void write_piece(peer_request const& r, disk_buffer_holder& buffer) = 0;
virtual void write_suggest(int piece) = 0;
virtual void write_bitfield() = 0;
virtual void write_reject_request(peer_request const& r) = 0;
virtual void write_allow_fast(int piece) = 0;
virtual void on_connected() = 0;
virtual void on_tick() {}
virtual void on_receive(error_code const& error
, std::size_t bytes_transferred) = 0;
virtual void on_sent(error_code const& error
, std::size_t bytes_transferred) = 0;
virtual int hit_send_barrier(std::vector<asio::mutable_buffer>&)
virtual int hit_send_barrier(std::vector<boost::asio::mutable_buffer>&)
{ return INT_MAX; }
bool allocate_disk_receive_buffer(int disk_buffer_size);

View File

@ -50,17 +50,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/version.hpp>
#if BOOST_VERSION < 103500
#include <asio/ip/tcp.hpp>
#include <asio/ip/udp.hpp>
#include <asio/write.hpp>
#include <asio/read.hpp>
#else
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ip/udp.hpp>
#include <boost/asio/write.hpp>
#include <boost/asio/read.hpp>
#endif
#ifdef __OBJC__
#undef Protocol
@ -71,16 +64,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
#if BOOST_VERSION < 103500
using ::asio::ip::tcp;
using ::asio::ip::udp;
using ::asio::async_write;
using ::asio::async_read;
typedef ::asio::ip::tcp::socket stream_socket;
typedef ::asio::ip::udp::socket datagram_socket;
typedef ::asio::ip::tcp::acceptor socket_acceptor;
#else
using boost::asio::ip::tcp;
using boost::asio::ip::udp;
using boost::asio::async_write;
@ -89,7 +72,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;
#endif
#if TORRENT_USE_IPV6
#ifdef IPV6_V6ONLY

View File

@ -50,7 +50,7 @@ namespace libtorrent
TORRENT_EXTRA_EXPORT tcp::endpoint parse_endpoint(std::string str, error_code& ec);
TORRENT_EXTRA_EXPORT std::string address_to_bytes(address const& a);
// internal
// internal
TORRENT_EXPORT std::string endpoint_to_bytes(udp::endpoint const& ep);
TORRENT_EXTRA_EXPORT void hash_address(address const& ip, sha1_hash& h);

View File

@ -198,8 +198,6 @@ private:
}
#if BOOST_VERSION >= 103500
namespace boost { namespace system {
template<> struct is_error_code_enum<libtorrent::socks_error::socks_error_code>
@ -209,7 +207,5 @@ namespace boost { namespace system {
{ static const bool value = true; };
} }
#endif // BOOST_VERSION
#endif

View File

@ -43,11 +43,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/function/function1.hpp>
#include <boost/bind.hpp>
#if BOOST_VERSION < 103500
#include <asio/ssl.hpp>
#else
#include <boost/asio/ssl.hpp>
#endif
// openssl seems to believe it owns
// this name in every single scope
#undef set_key

View File

@ -124,15 +124,15 @@ public:
// Attempts to add a port mapping for the specified protocol. Valid protocols are
// ``upnp::tcp`` and ``upnp::udp`` for the UPnP class and ``natpmp::tcp`` and
// ``natpmp::udp`` for the NAT-PMP class.
//
//
// ``external_port`` is the port on the external address that will be mapped. This
// is a hint, you are not guaranteed that this port will be available, and it may
// end up being something else. In the portmap_alert_ notification, the actual
// external port is reported.
//
//
// ``local_port`` is the port in the local machine that the mapping should forward
// to.
//
//
// The return value is an index that identifies this port mapping. This is used
// to refer to mappings that fails or succeeds in the portmap_error_alert_ and
// portmap_alert_ respectively. If The mapping fails immediately, the return value
@ -172,7 +172,7 @@ private:
// safer to always assume that we have to ask for
// permanent leases
enum { default_lease_time = 0 };
void resend_request(error_code const& e);
void on_reply(udp::endpoint const& from, char* buffer
, std::size_t bytes_transferred);
@ -181,7 +181,7 @@ private:
void next(rootdevice& d, int i, mutex::scoped_lock& l);
void update_map(rootdevice& d, int i, mutex::scoped_lock& l);
void on_upnp_xml(error_code const& e
, libtorrent::http_parser const& p, rootdevice& d
, http_connection& c);
@ -233,7 +233,7 @@ private:
// the time the port mapping will expire
time_point expires;
int action;
// the local port for this mapping. If this is set
@ -277,14 +277,14 @@ private:
// the interface url, through which the list of
// supported interfaces are fetched
std::string url;
// the url to the WANIP or WANPPP interface
std::string control_url;
// either the WANIP namespace or the WANPPP namespace
char const* service_namespace;
std::vector<mapping_t> mapping;
// this is the hostname, port and path
// component of the url or the control_url
// if it has been found
@ -297,7 +297,7 @@ private:
// true if the device supports specifying a
// specific external port, false if it doesn't
bool supports_specific_external;
bool disabled;
// this is true if the IP of this device is not
@ -319,11 +319,11 @@ private:
upnp_connection->close();
upnp_connection.reset();
}
bool operator<(rootdevice const& rhs) const
{ return url < rhs.url; }
};
struct upnp_state_t
{
std::vector<global_mapping_t> mappings;
@ -333,10 +333,10 @@ private:
std::vector<global_mapping_t> m_mappings;
std::string const& m_user_agent;
// the set of devices we've found
std::set<rootdevice> m_devices;
portmap_callback_t m_callback;
log_callback_t m_log_callback;
@ -364,7 +364,7 @@ private:
// response from a router UPnP device, we override the ignoring behavior and
// map them anyway.
deadline_timer m_map_timer;
bool m_disabled;
bool m_closing;
bool m_ignore_non_routers;
@ -380,8 +380,6 @@ private:
}
#if BOOST_VERSION >= 103500
namespace boost { namespace system {
template<> struct is_error_code_enum<libtorrent::upnp_errors::error_code_enum>
@ -391,7 +389,5 @@ namespace boost { namespace system {
{ static const bool value = true; };
} }
#endif // BOOST_VERSION
#endif

View File

@ -52,13 +52,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket_io.hpp"
#endif
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#include <asio/ip/multicast.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/ip/multicast.hpp>
#endif
#ifdef TORRENT_WINDOWS
#include <iphlpapi.h> // for if_nametoindex

View File

@ -530,7 +530,7 @@ namespace libtorrent
// Discard DH key exchange data, setup RC4 keys
init_pe_rc4_handler(secret, info_hash);
m_dh_key_exchange.reset(); // secret should be invalid at this point
// write the verification constant and crypto field
int encrypt_size = sizeof(msg) - 512 + pad_size - 40;
@ -547,8 +547,8 @@ namespace libtorrent
#endif
write_pe_vc_cryptofield(ptr, encrypt_size, crypto_provide, pad_size);
std::vector<asio::mutable_buffer> vec;
vec.push_back(asio::mutable_buffer(ptr, encrypt_size));
std::vector<boost::asio::mutable_buffer> vec;
vec.push_back(boost::asio::mutable_buffer(ptr, encrypt_size));
m_rc4->encrypt(vec);
send_buffer(msg, sizeof(msg) - 512 + pad_size);
}
@ -569,8 +569,8 @@ namespace libtorrent
char msg[512 + 8 + 4 + 2];
write_pe_vc_cryptofield(msg, sizeof(msg), crypto_select, pad_size);
std::vector<asio::mutable_buffer> vec;
vec.push_back(asio::mutable_buffer(msg, buf_size));
std::vector<boost::asio::mutable_buffer> vec;
vec.push_back(boost::asio::mutable_buffer(msg, buf_size));
m_rc4->encrypt(vec);
send_buffer(msg, buf_size);
@ -684,37 +684,37 @@ namespace libtorrent
return i;
}
// // Partial sync
// for (int i = 0; i < target_size; ++i)
// {
// // first is iterator in src[] at which mismatch occurs
// // second is iterator in target[] at which mismatch occurs
// std::pair<const char*, const char*> ret;
// int src_sync_size;
// if (i > traverse_limit) // partial sync test
// {
// ret = std::mismatch(src, src + src_size - (i - traverse_limit), &target[i]);
// src_sync_size = ret.first - src;
// if (src_sync_size == (src_size - (i - traverse_limit)))
// return i;
// }
// else // complete sync test
// {
// ret = std::mismatch(src, src + src_size, &target[i]);
// src_sync_size = ret.first - src;
// if (src_sync_size == src_size)
// return i;
// }
// }
// Partial sync
// for (int i = 0; i < target_size; ++i)
// {
// // first is iterator in src[] at which mismatch occurs
// // second is iterator in target[] at which mismatch occurs
// std::pair<const char*, const char*> ret;
// int src_sync_size;
// if (i > traverse_limit) // partial sync test
// {
// ret = std::mismatch(src, src + src_size - (i - traverse_limit), &target[i]);
// src_sync_size = ret.first - src;
// if (src_sync_size == (src_size - (i - traverse_limit)))
// return i;
// }
// else // complete sync test
// {
// ret = std::mismatch(src, src + src_size, &target[i]);
// src_sync_size = ret.first - src;
// if (src_sync_size == src_size)
// return i;
// }
// }
// no complete sync
// no complete sync
return -1;
}
void bt_peer_connection::rc4_decrypt(char* pos, int len)
{
std::vector<asio::mutable_buffer> vec;
vec.push_back(asio::mutable_buffer(pos, len));
std::vector<boost::asio::mutable_buffer> vec;
vec.push_back(boost::asio::mutable_buffer(pos, len));
int consume = 0;
int produce = len;
int packet_size = 0;
@ -3550,7 +3550,7 @@ namespace libtorrent
}
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
int bt_peer_connection::hit_send_barrier(std::vector<asio::mutable_buffer>& iovec)
int bt_peer_connection::hit_send_barrier(std::vector<boost::asio::mutable_buffer>& iovec)
{
int next_barrier = m_enc_handler.encrypt(iovec);
#ifndef TORRENT_DISABLE_LOGGING

View File

@ -143,7 +143,7 @@ namespace libtorrent
return insert;
}
std::vector<asio::const_buffer> const& chained_buffer::build_iovec(int to_send)
std::vector<boost::asio::const_buffer> const& chained_buffer::build_iovec(int to_send)
{
TORRENT_ASSERT(is_single_thread());
m_tmp_vec.clear();
@ -151,7 +151,7 @@ namespace libtorrent
return m_tmp_vec;
}
void chained_buffer::build_mutable_iovec(int bytes, std::vector<asio::mutable_buffer> &vec)
void chained_buffer::build_mutable_iovec(int bytes, std::vector<boost::asio::mutable_buffer> &vec)
{
build_vec(bytes, vec);
}

View File

@ -39,11 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/error_code.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/socket_type.hpp"
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#endif
#if TORRENT_USE_IFCONF
#include <sys/ioctl.h>

View File

@ -39,8 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
#if BOOST_VERSION >= 103500
struct libtorrent_error_category : boost::system::error_category
{
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
@ -323,7 +321,6 @@ namespace libtorrent
static http_error_category http_category;
return http_category;
}
#endif
#ifndef BOOST_NO_EXCEPTIONS
const char* libtorrent_exception::what() const TORRENT_EXCEPTION_THROW_SPECIFIER

View File

@ -151,9 +151,7 @@ namespace libtorrent
{
// this means that another instance of the storage
// is using the exact same file.
#if BOOST_VERSION >= 103500
ec = errors::file_collision;
#endif
return file_handle();
}

View File

@ -45,13 +45,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp>
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#include <asio/ip/multicast.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/ip/multicast.hpp>
#endif
#include <cstdlib>
#include <boost/config.hpp>
#include <cstdarg>

View File

@ -46,11 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/time.hpp"
#include "libtorrent/aux_/escape_string.hpp"
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#endif
//#define NATPMP_LOG

View File

@ -5402,15 +5402,15 @@ namespace libtorrent
if (m_send_barrier == 0)
{
std::vector<asio::mutable_buffer> vec;
std::vector<boost::asio::mutable_buffer> vec;
m_send_buffer.build_mutable_iovec(m_send_buffer.size(), vec);
int next_barrier = hit_send_barrier(vec);
for (std::vector<asio::mutable_buffer>::reverse_iterator i = vec.rbegin();
for (std::vector<boost::asio::mutable_buffer>::reverse_iterator i = vec.rbegin();
i != vec.rend(); ++i)
{
m_send_buffer.prepend_buffer(asio::buffer_cast<char*>(*i)
, asio::buffer_size(*i)
, asio::buffer_size(*i)
m_send_buffer.prepend_buffer(boost::asio::buffer_cast<char*>(*i)
, boost::asio::buffer_size(*i)
, boost::asio::buffer_size(*i)
, &nop
, NULL);
}
@ -5513,7 +5513,7 @@ namespace libtorrent
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing, "ASYNC_WRITE", "bytes: %d", amount_to_send);
#endif
std::vector<asio::const_buffer> const& vec = m_send_buffer.build_iovec(amount_to_send);
std::vector<boost::asio::const_buffer> const& vec = m_send_buffer.build_iovec(amount_to_send);
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("peer_connection::on_send_data");
#endif
@ -5546,7 +5546,7 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
if ((m_channel_state[download_channel] & peer_info::bw_disk) == 0) return;
boost::shared_ptr<peer_connection> me(self());
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "DISK", "dropped below disk buffer watermark");
#endif
@ -5617,19 +5617,19 @@ namespace libtorrent
if (m_quota[download_channel] == 0)
{
ec = asio::error::would_block;
ec = boost::asio::error::would_block;
return 0;
}
if (!can_read())
{
ec = asio::error::would_block;
ec = boost::asio::error::would_block;
return 0;
}
int max_receive = m_recv_buffer.max_receive();
boost::array<asio::mutable_buffer, 2> vec;
boost::array<boost::asio::mutable_buffer, 2> vec;
int num_bufs = 0;
// only apply the contiguous receive buffer when we don't have any
// outstanding requests. When we're likely to receive pieces, we'll
@ -5639,7 +5639,7 @@ namespace libtorrent
{
if (s == read_sync)
{
ec = asio::error::would_block;
ec = boost::asio::error::would_block;
return 0;
}
@ -5652,7 +5652,7 @@ namespace libtorrent
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("peer_connection::on_receive_data_nb");
#endif
m_socket->async_read_some(asio::null_buffers(), make_read_handler(
m_socket->async_read_some(boost::asio::null_buffers(), make_read_handler(
boost::bind(&peer_connection::on_receive_data_nb, self(), _1, _2)));
return 0;
}
@ -5665,7 +5665,7 @@ namespace libtorrent
if (max_receive == 0)
{
ec = asio::error::would_block;
ec = boost::asio::error::would_block;
return 0;
}
@ -5690,7 +5690,7 @@ namespace libtorrent
{
TORRENT_ASSERT(boost::asio::buffer_size(vec[0]) > 0);
m_socket->async_read_some(
asio::mutable_buffers_1(vec[0]), make_read_handler(
boost::asio::mutable_buffers_1(vec[0]), make_read_handler(
boost::bind(&peer_connection::on_receive_data, self(), _1, _2)));
}
else
@ -5710,8 +5710,8 @@ namespace libtorrent
if (num_bufs == 1)
{
TORRENT_ASSERT(boost::asio::buffer_size(vec[0]) > 0);
j.recv_buf = asio::buffer_cast<char*>(vec[0]);
j.buf_size = asio::buffer_size(vec[0]);
j.recv_buf = boost::asio::buffer_cast<char*>(vec[0]);
j.buf_size = boost::asio::buffer_size(vec[0]);
}
else
{
@ -5727,14 +5727,14 @@ namespace libtorrent
size_t ret = 0;
if (num_bufs == 1)
{
ret = m_socket->read_some(asio::mutable_buffers_1(vec[0]), ec);
ret = m_socket->read_some(boost::asio::mutable_buffers_1(vec[0]), ec);
}
else
{
ret = m_socket->read_some(vec, ec);
}
// this is weird. You would imagine read_some() would do this
if (ret == 0 && !ec) ec = asio::error::eof;
if (ret == 0 && !ec) ec = boost::asio::error::eof;
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::incoming, "SYNC_READ", "max: %d ret: %d e: %s"
@ -5904,13 +5904,13 @@ namespace libtorrent
if (buffer_size > 2097152) buffer_size = 2097152;
asio::mutable_buffer buffer = m_recv_buffer.reserve(buffer_size);
boost::asio::mutable_buffer buffer = m_recv_buffer.reserve(buffer_size);
TORRENT_ASSERT(m_recv_buffer.normalized());
// utp sockets aren't thread safe...
if (is_utp(*m_socket))
{
bytes_transferred = m_socket->read_some(asio::mutable_buffers_1(buffer), ec);
bytes_transferred = m_socket->read_some(boost::asio::mutable_buffers_1(buffer), ec);
if (ec)
{
@ -5934,8 +5934,8 @@ namespace libtorrent
#endif
socket_job j;
j.type = socket_job::read_job;
j.recv_buf = asio::buffer_cast<char*>(buffer);
j.buf_size = asio::buffer_size(buffer);
j.recv_buf = boost::asio::buffer_cast<char*>(buffer);
j.buf_size = boost::asio::buffer_size(buffer);
j.peer = self();
m_ses.post_socket_job(j);
return;
@ -6086,7 +6086,7 @@ namespace libtorrent
error_code ec;
bytes_transferred = try_read(read_sync, ec);
TORRENT_ASSERT(bytes_transferred > 0 || ec);
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;
if (ec)
{
trancieve_ip_packet(bytes_in_loop, m_remote.address().is_v6());

View File

@ -199,7 +199,7 @@ void network_thread_pool::process_job(socket_job const& j, bool post)
{
if (j.recv_buf)
{
j.peer->get_socket()->async_read_some(asio::buffer(j.recv_buf, j.buf_size)
j.peer->get_socket()->async_read_some(boost::asio::buffer(j.recv_buf, j.buf_size)
, j.peer->make_read_handler(boost::bind(
&peer_connection::on_receive_data, j.peer, _1, _2)));
}
@ -344,7 +344,7 @@ namespace aux {
#endif
m_io_service(ios)
#ifdef TORRENT_USE_OPENSSL
, m_ssl_ctx(m_io_service, asio::ssl::context::sslv23)
, m_ssl_ctx(m_io_service, boost::asio::ssl::context::sslv23)
#endif
, m_alerts(m_settings.get_int(settings_pack::alert_queue_size), alert::all_categories)
#ifndef TORRENT_NO_DEPRECATE
@ -459,7 +459,7 @@ namespace aux {
error_code ec;
#ifdef TORRENT_USE_OPENSSL
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);
#if BOOST_VERSION >= 104700
#if OPENSSL_VERSION_NUMBER >= 0x90812f
SSL_CTX_set_tlsext_servername_callback(m_ssl_ctx.native_handle(), servername_callback);
@ -2162,7 +2162,7 @@ retry:
complete_async("session_impl::on_i2p_accept");
#endif
m_i2p_listen_socket.reset();
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
if (e)
{
if (m_alerts.should_post<listen_failed_alert>())
@ -2187,7 +2187,7 @@ retry:
if (ec)
{
// don't bubble up operation aborted errors to the user
if (ec != asio::error::operation_aborted
if (ec != boost::asio::error::operation_aborted
&& m_alerts.should_post<udp_error_alert>())
m_alerts.emplace_alert<udp_error_alert>(ep, ec);
@ -2245,7 +2245,7 @@ retry:
boost::shared_ptr<socket_acceptor> listener = listen_socket.lock();
if (!listener) return;
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
if (m_abort) return;
@ -2637,7 +2637,7 @@ retry:
complete_async("session_impl::on_socks_accept");
#endif
m_socks_listen_socket.reset();
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
if (e)
{
if (m_alerts.should_post<listen_failed_alert>())
@ -2841,7 +2841,7 @@ retry:
#endif
}
if (e == asio::error::operation_aborted) return;
if (e == boost::asio::error::operation_aborted) return;
if (e)
{

View File

@ -30,6 +30,9 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <ctime>
@ -41,9 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp>
#include <boost/version.hpp>
#include <boost/scoped_array.hpp>
#if BOOST_VERSION >= 103500
#include <boost/system/system_error.hpp>
#endif
#include <boost/system/error_code.hpp>
#if defined(__APPLE__)
// for getattrlist()
@ -66,7 +67,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/storage.hpp"
#include "libtorrent/torrent.hpp"
#include "libtorrent/hasher.hpp"
@ -454,7 +454,7 @@ namespace libtorrent
return false;
}
}
// if we didn't find the file, check the next one
if (m_stat_cache.get_filesize(i) == stat_cache::no_exist) continue;
@ -555,7 +555,7 @@ namespace libtorrent
void default_storage::delete_one_file(std::string const& p, error_code& ec)
{
remove(p, ec);
DFLOG(stderr, "[%p] delete_one_file: %s [%s]\n", this, p.c_str(), ec.message().c_str());
if (ec == boost::system::errc::no_such_file_or_directory)
@ -569,7 +569,7 @@ namespace libtorrent
#if TORRENT_USE_ASSERTS
// this is a fence job, we expect no other
// threads to hold any references to any files
// in this file storage. Assert that that's the
// in this file storage. Assert that that's the
// case
if (!m_pool.assert_idle_files(this))
{
@ -715,7 +715,7 @@ namespace libtorrent
++file_index;
TORRENT_ASSERT(file_index != files().num_files());
}
error_code ec;
file_handle handle = open_file_impl(file_index, file::read_only, ec);
if (ec) return slot;
@ -742,7 +742,7 @@ namespace libtorrent
m_mapped_files->rename_file(i, new_filename);
}
}
bdecode_node file_priority = rd.dict_find_list("file_priority");
if (file_priority && file_priority.list_size()
== files().num_files())
@ -760,13 +760,13 @@ namespace libtorrent
ec.operation = storage_error::check_resume;
return false;
}
if (file_sizes_ent.list_size() == 0)
{
ec.ec = errors::no_files_in_resume_data;
return false;
}
file_storage const& fs = files();
if (file_sizes_ent.list_size() != fs.num_files())
{
@ -991,14 +991,14 @@ namespace libtorrent
{
ec.file = -1;
ec.operation = storage_error::mkdir;
return piece_manager::fatal_disk_error;
return piece_manager::fatal_disk_error;
}
}
else if (ec)
{
ec.file = -1;
ec.operation = storage_error::mkdir;
return piece_manager::fatal_disk_error;
return piece_manager::fatal_disk_error;
}
m_pool.release(this);
@ -1067,7 +1067,7 @@ namespace libtorrent
{
ec.file = -1;
ec.operation = storage_error::partfile_move;
return piece_manager::fatal_disk_error;
return piece_manager::fatal_disk_error;
}
}
@ -1096,7 +1096,7 @@ namespace libtorrent
return readwritev(bufs, slot, offset, num_bufs, op, ec);
}
// much of what needs to be done when reading and writing
// much of what needs to be done when reading and writing
// is buffer management and piece to file mapping. Most
// of that is the same for reading and writing. This function
// is a template, and the fileop decides what to do with the
@ -1188,7 +1188,7 @@ namespace libtorrent
// we're writing to it
m_stat_cache.set_dirty(file_index);
}
if ((file_index < int(m_file_priority.size())
&& m_file_priority[file_index] == 0)
|| files().pad_file_at(file_index))
@ -1366,7 +1366,7 @@ namespace libtorrent
{
error_code ec;
if (m_part_file) m_part_file->flush_metadata(ec);
return false;
}
@ -1489,7 +1489,7 @@ namespace libtorrent
if (se)
{
ec = se;
return fatal_disk_error;
return fatal_disk_error;
}
if (has_files)
@ -1502,7 +1502,7 @@ namespace libtorrent
return check_init_storage(ec);
}
int piece_manager::check_init_storage(storage_error& ec)
{
storage_error se;
@ -1510,14 +1510,14 @@ namespace libtorrent
if (se)
{
ec = se;
return fatal_disk_error;
return fatal_disk_error;
}
return no_error;
}
// check if the fastresume data is up to date
// if it is, use it and return true. If it
// if it is, use it and return true. If it
// isn't return false and the full check
// will be run. If the links pointer is non-null, it has the same number
// of elements as there are files. Each element is either empty or contains
@ -1530,7 +1530,7 @@ namespace libtorrent
, storage_error& ec)
{
TORRENT_ASSERT(m_files.piece_length() > 0);
// if we don't have any resume data, return
if (rd.type() == bdecode_node::none_t) return check_no_fastresume(ec);
@ -1669,7 +1669,7 @@ namespace libtorrent
++m_outstanding_jobs;
return false;
}
m_blocked_jobs.push_back(j);
#if TORRENT_USE_ASSERTS

View File

@ -423,7 +423,7 @@ namespace libtorrent
{
if (m_abort) return;
if (ec && ec != asio::error::eof)
if (ec && ec != boost::asio::error::eof)
{
set_error(ec, error_file_url);
pause();
@ -609,7 +609,7 @@ namespace libtorrent
{
if (m_abort) return;
if (ec && ec != asio::error::eof)
if (ec && ec != boost::asio::error::eof)
{
set_error(ec, error_file_url);
pause();
@ -1106,7 +1106,7 @@ namespace libtorrent
// we failed to write j->piece to disk tell the piece picker
// this will block any other peer from issuing requests
// to this piece, until we've cleared it.
if (j->error.ec == asio::error::operation_aborted)
if (j->error.ec == boost::asio::error::operation_aborted)
{
if (has_picker())
picker().mark_as_canceled(block_finished, NULL);
@ -1149,7 +1149,7 @@ namespace libtorrent
return;
}
if (j->error.ec == asio::error::operation_aborted) return;
if (j->error.ec == boost::asio::error::operation_aborted) return;
// notify the user of the error
if (alerts().should_post<file_error_alert>())
@ -1590,7 +1590,7 @@ namespace libtorrent
if (!ctx)
{
error_code ec(::ERR_get_error(),
asio::error::get_ssl_category());
boost::asio::error::get_ssl_category());
set_error(ec, error_file_ssl_ctx);
pause();
return;
@ -1628,7 +1628,7 @@ namespace libtorrent
if (!cert_store)
{
error_code ec(::ERR_get_error(),
asio::error::get_ssl_category());
boost::asio::error::get_ssl_category());
set_error(ec, error_file_ssl_ctx);
pause();
return;
@ -1646,7 +1646,7 @@ namespace libtorrent
if (!certificate)
{
error_code ec(::ERR_get_error(),
asio::error::get_ssl_category());
boost::asio::error::get_ssl_category());
X509_STORE_free(cert_store);
set_error(ec, error_file_ssl_ctx);
pause();
@ -1673,7 +1673,7 @@ namespace libtorrent
// tell the client we need a cert for this torrent
alerts().emplace_alert<torrent_need_cert_alert>(get_handle());
#else
set_error(asio::error::operation_not_supported, error_file_ssl_ctx);
set_error(boost::asio::error::operation_not_supported, error_file_ssl_ctx);
pause();
#endif
}
@ -6486,7 +6486,7 @@ namespace libtorrent
{
return m_resolve_countries && !settings().get_bool(settings_pack::force_proxy);
}
void torrent::resolve_peer_country(boost::shared_ptr<peer_connection> const& p) const
{
TORRENT_ASSERT(is_single_thread());
@ -6497,7 +6497,7 @@ namespace libtorrent
|| p->in_handshake()
|| p->remote().address().is_v6()) return;
asio::ip::address_v4 reversed(swap_bytes(p->remote().address().to_v4().to_ulong()));
boost::asio::ip::address_v4 reversed(swap_bytes(p->remote().address().to_v4().to_ulong()));
error_code ec;
std::string hostname = reversed.to_string(ec) + ".zz.countries.nerd.dk";
if (ec)
@ -6526,7 +6526,7 @@ namespace libtorrent
TORRENT_ASSERT(is_single_thread());
INVARIANT_CHECK;
m_resolving_country = false;
if (m_abort) return;
@ -7661,7 +7661,7 @@ namespace libtorrent
#else // BOOST_VERSION
if (is_ssl_torrent())
{
p->disconnect(asio::error::operation_not_supported, op_bittorrent);
p->disconnect(boost::asio::error::operation_not_supported, op_bittorrent);
return false;
}
#endif

View File

@ -45,11 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp>
#include <boost/array.hpp>
#include <boost/system/system_error.hpp>
#if BOOST_VERSION < 103500
#include <asio/read.hpp>
#else
#include <boost/asio/read.hpp>
#endif
#if defined TORRENT_ASIO_DEBUGGING
#include "libtorrent/debug.hpp"

View File

@ -47,13 +47,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#if BOOST_VERSION < 103500
#include <asio/ip/host_name.hpp>
#include <asio/ip/multicast.hpp>
#else
#include <boost/asio/ip/host_name.hpp>
#include <boost/asio/ip/multicast.hpp>
#endif
#include <cstdlib>
namespace libtorrent {
@ -838,7 +833,7 @@ void upnp::delete_port_mapping(rootdevice& d, int i)
, d.mapping[i].external_port
, (d.mapping[i].protocol == udp ? "UDP" : "TCP")
, soap_action);
post(d, soap, soap_action, l);
}
@ -1184,8 +1179,6 @@ namespace
}
#if BOOST_VERSION >= 103500
struct upnp_error_category : boost::system::error_category
{
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT
@ -1222,16 +1215,6 @@ boost::system::error_category& get_upnp_category()
return cat;
}
#else
boost::system::error_category& get_upnp_category()
{
static ::asio::error::error_category cat(21);
return cat;
}
#endif
void upnp::on_upnp_get_ip_address_response(error_code const& e
, libtorrent::http_parser const& p, rootdevice& d
, http_connection& c)

View File

@ -192,9 +192,9 @@ int copy_buffers(T const& b, char* target)
for (typename T::const_iterator i = b.begin()
, end(b.end()); i != end; ++i)
{
memcpy(target, libtorrent::asio::buffer_cast<char const*>(*i), libtorrent::asio::buffer_size(*i));
target += libtorrent::asio::buffer_size(*i);
copied += libtorrent::asio::buffer_size(*i);
memcpy(target, boost::asio::buffer_cast<char const*>(*i), boost::asio::buffer_size(*i));
target += boost::asio::buffer_size(*i);
copied += boost::asio::buffer_size(*i);
}
return copied;
}
@ -203,7 +203,7 @@ bool compare_chained_buffer(chained_buffer& b, char const* mem, int size)
{
if (size == 0) return true;
std::vector<char> flat(size);
std::vector<libtorrent::asio::const_buffer> const& iovec2 = b.build_iovec(size);
std::vector<boost::asio::const_buffer> const& iovec2 = b.build_iovec(size);
int copied = copy_buffers(iovec2, &flat[0]);
TEST_CHECK(copied == size);
return std::memcmp(&flat[0], mem, size) == 0;

View File

@ -103,13 +103,7 @@ struct test_storage : default_storage
{
std::cerr << "storage written: " << m_written << " limit: " << m_limit << std::endl;
error_code ec;
#if BOOST_VERSION == 103500
ec = error_code(boost::system::posix_error::no_space_on_device, get_posix_category());
#elif BOOST_VERSION > 103500
ec = error_code(boost::system::errc::no_space_on_device, get_posix_category());
#else
ec = error_code(ENOSPC, get_posix_category());
#endif
se.ec = ec;
return 0;
}