Browse Source

boost 1.66 patch...

miguelfreitas
erqan 7 years ago
parent
commit
575e929d29
  1. 8
      libtorrent/include/libtorrent/io_service_fwd.hpp
  2. 17
      libtorrent/include/libtorrent/proxy_base.hpp
  3. 8
      libtorrent/include/libtorrent/socket_type.hpp
  4. 12
      libtorrent/include/libtorrent/ssl_stream.hpp
  5. 16
      libtorrent/include/libtorrent/utp_stream.hpp
  6. 24
      libtorrent/src/file.cpp
  7. 3
      libtorrent/src/http_connection.cpp
  8. 6
      libtorrent/src/peer_connection.cpp
  9. 2
      libtorrent/src/session_impl.cpp
  10. 4
      libtorrent/src/torrent.cpp
  11. 6
      libtorrent/src/udp_socket.cpp
  12. 20
      src/bitcoinrpc.cpp

8
libtorrent/include/libtorrent/io_service_fwd.hpp

@ -51,13 +51,17 @@ POSSIBILITY OF SUCH DAMAGE. @@ -51,13 +51,17 @@ POSSIBILITY OF SUCH DAMAGE.
#undef Protocol
#endif
#if BOOST_VERSION >= 103500
namespace boost {
#endif
namespace asio {
#if BOOST_VERSION < 106600
class io_service;
#else
class io_context;
typedef io_context io_service;
#endif
}
#if BOOST_VERSION >= 103500
}

17
libtorrent/include/libtorrent/proxy_base.hpp

@ -63,6 +63,11 @@ public: @@ -63,6 +63,11 @@ public:
m_port = port;
}
#if BOOST_VERSION >= 106600
typedef tcp::socket::executor_type executor_type;
executor_type get_executor() { return m_sock.get_executor(); }
#endif
template <class Mutable_Buffers, class Handler>
void async_read_some(Mutable_Buffers const& buffers, Handler const& handler)
{
@ -119,6 +124,18 @@ public: @@ -119,6 +124,18 @@ public:
m_sock.async_write_some(buffers, handler);
}
#ifndef BOOST_NO_EXCEPTIONS
void non_blocking(bool b)
{
m_sock.non_blocking(b);
}
#endif
error_code non_blocking(bool b, error_code& ec)
{
return m_sock.non_blocking(b, ec);
}
#ifndef BOOST_NO_EXCEPTIONS
template <class SettableSocketOption>
void set_option(SettableSocketOption const& opt)

8
libtorrent/include/libtorrent/socket_type.hpp

@ -272,6 +272,14 @@ namespace libtorrent @@ -272,6 +272,14 @@ namespace libtorrent
return (S const*)m_data;
}
void non_blocking(bool b, error_code& ec)
{ TORRENT_SOCKTYPE_FORWARD(non_blocking(b, ec)) }
#ifndef BOOST_NO_EXCEPTIONS
void non_blocking(bool b)
{ TORRENT_SOCKTYPE_FORWARD(non_blocking(b)) }
#endif
private:
void destruct();

12
libtorrent/include/libtorrent/ssl_stream.hpp

@ -62,6 +62,11 @@ public: @@ -62,6 +62,11 @@ public:
typedef typename Stream::endpoint_type endpoint_type;
typedef typename Stream::protocol_type protocol_type;
#if BOOST_VERSION >= 106600
typedef tcp::socket::executor_type executor_type;
executor_type get_executor() { return m_sock.get_executor(); }
#endif
void set_host_name(std::string name)
{
#if OPENSSL_VERSION_NUMBER >= 0x90812f
@ -266,6 +271,13 @@ public: @@ -266,6 +271,13 @@ public:
return m_sock.next_layer();
}
#ifndef BOOST_NO_EXCEPTIONS
void non_blocking(bool b) { m_sock.next_layer().non_blocking(b); }
#endif
error_code non_blocking(bool b, error_code& ec)
{ return m_sock.next_layer().non_blocking(b, ec); }
private:
void connected(error_code const& e, boost::shared_ptr<handler_type> h)

16
libtorrent/include/libtorrent/utp_stream.hpp

@ -177,6 +177,11 @@ public: @@ -177,6 +177,11 @@ public:
typedef stream_socket::endpoint_type endpoint_type;
typedef stream_socket::protocol_type protocol_type;
#if BOOST_VERSION >= 106600
typedef tcp::socket::executor_type executor_type;
executor_type get_executor() { return m_io_service.get_executor(); }
#endif
explicit utp_stream(asio::io_service& io_service);
~utp_stream();
@ -194,6 +199,12 @@ public: @@ -194,6 +199,12 @@ public:
template <class IO_Control_Command>
void io_control(IO_Control_Command& ioc, error_code& ec) {}
#ifndef BOOST_NO_EXCEPTIONS
void non_blocking(bool) {}
#endif
error_code non_blocking(bool, error_code&) { return error_code(); }
#ifndef BOOST_NO_EXCEPTIONS
void bind(endpoint_type const& /*endpoint*/) {}
#endif
@ -328,8 +339,13 @@ public: @@ -328,8 +339,13 @@ public:
size_t buf_size = 0;
#endif
#if BOOST_VERSION >= 106600
for (auto i = buffer_sequence_begin(buffers)
, end(buffer_sequence_end(buffers)); i != end; ++i)
#else
for (typename Mutable_Buffers::const_iterator i = buffers.begin()
, end(buffers.end()); i != end; ++i)
#endif // BOOST_VERSION
{
using asio::buffer_cast;
using asio::buffer_size;

24
libtorrent/src/file.cpp

@ -188,7 +188,7 @@ namespace libtorrent @@ -188,7 +188,7 @@ namespace libtorrent
if (_stati64(f.c_str(), &ret) < 0)
#endif
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
return;
}
#else
@ -200,7 +200,7 @@ namespace libtorrent @@ -200,7 +200,7 @@ namespace libtorrent
retval = ::stat(f.c_str(), &ret);
if (retval < 0)
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
return;
}
#endif // TORRENT_WINDOWS
@ -239,7 +239,7 @@ namespace libtorrent @@ -239,7 +239,7 @@ namespace libtorrent
if (::rename(f1.c_str(), f2.c_str()) < 0)
#endif
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
return;
}
}
@ -279,7 +279,7 @@ namespace libtorrent @@ -279,7 +279,7 @@ namespace libtorrent
#else
int ret = mkdir(n.c_str(), 0777);
if (ret < 0 && errno != EEXIST)
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
#endif
}
@ -335,13 +335,13 @@ namespace libtorrent @@ -335,13 +335,13 @@ namespace libtorrent
// this only works on 10.5
copyfile_state_t state = copyfile_state_alloc();
if (copyfile(f1.c_str(), f2.c_str(), state, COPYFILE_ALL) < 0)
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
copyfile_state_free(state);
#else
int infd = ::open(inf.c_str(), O_RDONLY);
if (infd < 0)
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
return;
}
@ -355,7 +355,7 @@ namespace libtorrent @@ -355,7 +355,7 @@ namespace libtorrent
if (outfd < 0)
{
close(infd);
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
return;
}
char buffer[4096];
@ -365,13 +365,13 @@ namespace libtorrent @@ -365,13 +365,13 @@ namespace libtorrent
if (num_read == 0) break;
if (num_read < 0)
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
break;
}
int num_written = write(outfd, buffer, num_read);
if (num_written < num_read)
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
break;
}
if (num_read < int(sizeof(buffer))) break;
@ -699,7 +699,7 @@ namespace libtorrent @@ -699,7 +699,7 @@ namespace libtorrent
std::string f = convert_to_native(inf);
if (::remove(f.c_str()) < 0)
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
return;
}
#endif // TORRENT_WINDOWS
@ -792,7 +792,7 @@ namespace libtorrent @@ -792,7 +792,7 @@ namespace libtorrent
m_handle = opendir(p.c_str());
if (m_handle == 0)
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
m_done = true;
return;
}
@ -844,7 +844,7 @@ namespace libtorrent @@ -844,7 +844,7 @@ namespace libtorrent
dirent* dummy;
if (readdir_r(m_handle, &m_dirent, &dummy) != 0)
{
ec.assign(errno, boost::system::get_generic_category());
ec.assign(errno, boost::system::generic_category());
m_done = true;
}
if (dummy == 0) m_done = true;

3
libtorrent/src/http_connection.cpp

@ -307,8 +307,7 @@ void http_connection::start(std::string const& hostname, std::string const& port @@ -307,8 +307,7 @@ void http_connection::start(std::string const& hostname, std::string const& port
{
if (m_ssl_ctx == 0)
{
m_ssl_ctx = new (std::nothrow) boost::asio::ssl::context(
m_resolver.get_io_service(), asio::ssl::context::sslv23_client);
m_ssl_ctx = new (std::nothrow) boost::asio::ssl::context(asio::ssl::context::sslv23_client);
if (m_ssl_ctx)
{
m_own_ssl_context = true;

6
libtorrent/src/peer_connection.cpp

@ -465,9 +465,8 @@ namespace libtorrent @@ -465,9 +465,8 @@ namespace libtorrent
if (!m_outgoing)
{
tcp::socket::non_blocking_io ioc(true);
error_code ec;
m_socket->io_control(ioc, ec);
m_socket->non_blocking(true, ec);
if (ec)
{
disconnect(ec);
@ -5706,11 +5705,10 @@ namespace libtorrent @@ -5706,11 +5705,10 @@ namespace libtorrent
// set the socket to non-blocking, so that we can
// read the entire buffer on each read event we get
tcp::socket::non_blocking_io ioc(true);
#if defined TORRENT_VERBOSE_LOGGING
peer_log("*** SET NON-BLOCKING");
#endif
m_socket->io_control(ioc, ec);
m_socket->non_blocking(true, ec);
if (ec)
{
disconnect(ec);

2
libtorrent/src/session_impl.cpp

@ -614,7 +614,7 @@ namespace aux { @@ -614,7 +614,7 @@ namespace aux {
, m_swarmDb(swarmDb)
, m_io_service()
#ifdef TORRENT_USE_OPENSSL
, m_ssl_ctx(m_io_service, asio::ssl::context::sslv23)
, m_ssl_ctx(asio::ssl::context::sslv23)
#endif
, m_alerts(m_settings.alert_queue_size, alert_mask)
, m_disk_thread(m_io_service, boost::bind(&session_impl::on_disk_queue, this), m_files)

4
libtorrent/src/torrent.cpp

@ -1405,7 +1405,7 @@ namespace libtorrent @@ -1405,7 +1405,7 @@ namespace libtorrent
// inject the root certificate, and no other, to
// verify other peers against
boost::shared_ptr<context> ctx(
new (std::nothrow) context(m_ses.m_io_service, context::sslv23));
new (std::nothrow) context(context::sslv23));
if (!ctx)
{
@ -1442,7 +1442,7 @@ namespace libtorrent @@ -1442,7 +1442,7 @@ namespace libtorrent
return;
}
SSL_CTX* ssl_ctx = ctx->impl();
SSL_CTX* ssl_ctx = ctx->native_handle();
// create a new x.509 certificate store
X509_STORE* cert_store = X509_STORE_new();
if (!cert_store)

6
libtorrent/src/udp_socket.cpp

@ -700,8 +700,7 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec) @@ -700,8 +700,7 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
if (ec) return;
m_ipv4_sock.bind(ep, ec);
if (ec) return;
udp::socket::non_blocking_io ioc(true);
m_ipv4_sock.io_control(ioc, ec);
m_ipv4_sock.non_blocking(true, ec);
if (ec) return;
setup_read(&m_ipv4_sock);
}
@ -714,8 +713,7 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec) @@ -714,8 +713,7 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
#endif
m_ipv6_sock.bind(ep, ec);
if (ec) return;
udp::socket::non_blocking_io ioc(true);
m_ipv6_sock.io_control(ioc, ec);
m_ipv6_sock.non_blocking(true, ec);
if (ec) return;
setup_read(&m_ipv6_sock);
}

20
src/bitcoinrpc.cpp

@ -691,8 +691,8 @@ private: @@ -691,8 +691,8 @@ private:
void ServiceConnection(AcceptedConnection *conn);
// Forward declaration required for RPCListen
template <typename Protocol, typename SocketAcceptorService>
static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
template <typename Protocol>
static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol> > acceptor,
ssl::context& context,
bool fUseSSL,
AcceptedConnection* conn,
@ -701,8 +701,8 @@ static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, @@ -701,8 +701,8 @@ static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol,
/**
* Sets up I/O resources to accept and handle a new connection.
*/
template <typename Protocol, typename SocketAcceptorService>
static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
template <typename Protocol>
static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol> > acceptor,
ssl::context& context,
const bool fUseSSL)
{
@ -712,7 +712,7 @@ static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketA @@ -712,7 +712,7 @@ static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketA
acceptor->async_accept(
conn->sslStream.lowest_layer(),
conn->peer,
boost::bind(&RPCAcceptHandler<Protocol, SocketAcceptorService>,
boost::bind(&RPCAcceptHandler<Protocol>,
acceptor,
boost::ref(context),
fUseSSL,
@ -723,8 +723,8 @@ static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketA @@ -723,8 +723,8 @@ static void RPCListen(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketA
/**
* Accept and handle incoming connection.
*/
template <typename Protocol, typename SocketAcceptorService>
static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
template <typename Protocol>
static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol> > acceptor,
ssl::context& context,
const bool fUseSSL,
AcceptedConnection* conn,
@ -794,7 +794,7 @@ void StartRPCThreads() @@ -794,7 +794,7 @@ void StartRPCThreads()
assert(rpc_io_service == NULL);
rpc_io_service = new asio::io_service();
rpc_ssl_context = new ssl::context(*rpc_io_service, ssl::context::sslv23);
rpc_ssl_context = new ssl::context(ssl::context::sslv23);
const bool fUseSSL = GetBoolArg("-rpcssl", false);
@ -813,7 +813,7 @@ void StartRPCThreads() @@ -813,7 +813,7 @@ void StartRPCThreads()
else printf("ThreadRPCServer ERROR: missing server private key file %s\n", pathPKFile.string().c_str());
string strCiphers = GetArg("-rpcsslciphers", "TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH");
SSL_CTX_set_cipher_list(rpc_ssl_context->impl(), strCiphers.c_str());
SSL_CTX_set_cipher_list(rpc_ssl_context->native_handle(), strCiphers.c_str());
}
// Try a dual IPv6/IPv4 socket, falling back to separate IPv4 and IPv6 sockets
@ -1187,7 +1187,7 @@ Object CallRPC(const string& strMethod, const Array& params) @@ -1187,7 +1187,7 @@ Object CallRPC(const string& strMethod, const Array& params)
// Connect to localhost
bool fUseSSL = GetBoolArg("-rpcssl", false);
asio::io_service io_service;
ssl::context context(io_service, ssl::context::sslv23);
ssl::context context(ssl::context::sslv23);
context.set_options(ssl::context::no_sslv2);
asio::ssl::stream<asio::ip::tcp::socket> sslStream(io_service, context);
SSLIOStreamDevice<asio::ip::tcp> d(sslStream, fUseSSL);

Loading…
Cancel
Save