Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9aaa546

Browse files
committed
Fix for boost 1.70 (get_io_service() was deprecated and was removed)
1 parent5351fc6 commit9aaa546

File tree

5 files changed

+29
-40
lines changed

5 files changed

+29
-40
lines changed

‎boost/network/compat.hpp‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef BOOST_NETWORK_COMPAT_HPP__
2+
#defineBOOST_NETWORK_COMPAT_HPP__
3+
4+
// Copyright 2010 (C) Dean Michael Berris
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
// This macro is used to solve a compatibility problem with Boost >= 1.70
10+
// where the deprecated method get_io_service() was removed
11+
#if BOOST_VERSION >= 107000
12+
#defineCPP_NETLIB_ASIO_GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
13+
#else
14+
#defineCPP_NETLIB_ASIO_GET_IO_SERVICE(s) ((s).get_io_service())
15+
#endif
16+
17+
#endif// BOOST_NETWORK_COMPAT_HPP__

‎boost/network/protocol/http/client/connection/async_base.hpp‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@
1616
#include<boost/network/protocol/http/client/connection/async_normal.hpp>
1717
#include<boost/network/protocol/http/traits/resolver_policy.hpp>
1818
#include<boost/network/traits/string.hpp>
19-
20-
#ifndef GET_IO_SERVICE
21-
#if BOOST_VERSION >= 107000
22-
#defineGET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
23-
#else
24-
#defineGET_IO_SERVICE(s) ((s).get_io_service())
25-
#endif
26-
#endif
19+
#include<boost/network/compat.hpp>
2720

2821
namespaceboost {
2922
namespacenetwork {
@@ -67,7 +60,7 @@ struct async_connection_base {
6760
async_connection;
6861
typedeftypename delegate_factory<Tag>::type delegate_factory_type;
6962
auto delegate =delegate_factory_type::new_connection_delegate(
70-
GET_IO_SERVICE(resolver), https, always_verify_peer,
63+
CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver), https, always_verify_peer,
7164
certificate_filename, verify_path, certificate_file, private_key_file,
7265
ciphers, sni_hostname, ssl_options);
7366
auto temp = std::make_shared<async_connection>(

‎boost/network/protocol/http/client/connection/async_normal.hpp‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@
3232
#include<boost/range/algorithm/transform.hpp>
3333
#include<boost/range/iterator_range.hpp>
3434
#include<boost/throw_exception.hpp>
35-
36-
#ifndef GET_IO_SERVICE
37-
#if BOOST_VERSION >= 107000
38-
#defineGET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
39-
#else
40-
#defineGET_IO_SERVICE(s) ((s).get_io_service())
41-
#endif
42-
#endif
35+
#include<boost/network/compat.hpp>
4336

4437
namespaceboost {
4538
namespacenetwork {
@@ -162,12 +155,12 @@ struct http_async_connection
162155
connection_delegate_ptr delegate)
163156
: timeout_(timeout),
164157
remove_chunk_markers_(remove_chunk_markers),
165-
timer_(GET_IO_SERVICE(resolver)),
158+
timer_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)),
166159
is_timedout_(false),
167160
follow_redirect_(follow_redirect),
168161
resolver_(resolver),
169162
resolve_(std::move(resolve)),
170-
request_strand_(GET_IO_SERVICE(resolver)),
163+
request_strand_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)),
171164
delegate_(std::move(delegate)) {}
172165

173166
// This is the main entry point for the connection/request pipeline.

‎boost/network/protocol/http/client/connection/sync_normal.hpp‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@
1616
#include<boost/network/protocol/http/response.hpp>
1717
#include<boost/network/protocol/http/traits/resolver_policy.hpp>
1818
#include<boost/network/traits/string.hpp>
19-
20-
#ifndef GET_IO_SERVICE
21-
#if BOOST_VERSION >= 107000
22-
#defineGET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
23-
#else
24-
#defineGET_IO_SERVICE(s) ((s).get_io_service())
25-
#endif
26-
#endif
19+
#include<boost/network/compat.hpp>
2720

2821
namespaceboost {
2922
namespacenetwork {
@@ -57,10 +50,10 @@ struct http_sync_connection
5750
int timeout)
5851
: connection_base(),
5952
timeout_(timeout),
60-
timer_(GET_IO_SERVICE(resolver)),
53+
timer_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)),
6154
resolver_(resolver),
6255
resolve_(std::move(resolve)),
63-
socket_(GET_IO_SERVICE(resolver)) {}
56+
socket_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)) {}
6457

6558
voidinit_socket(string_typeconst& hostname, string_typeconst& port) {
6659
connection_base::init_socket(socket_, resolver_, hostname, port, resolve_);

‎boost/network/protocol/http/client/connection/sync_ssl.hpp‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@
1616
#include<boost/algorithm/string/predicate.hpp>
1717
#include<boost/network/protocol/http/request.hpp>
1818
#include<boost/network/protocol/http/traits/resolver_policy.hpp>
19-
20-
#ifndef GET_IO_SERVICE
21-
#if BOOST_VERSION >= 107000
22-
#defineGET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
23-
#else
24-
#defineGET_IO_SERVICE(s) ((s).get_io_service())
25-
#endif
26-
#endif
19+
#include<boost/network/compat.hpp>
2720

2821
namespaceboost {
2922
namespacenetwork {
@@ -68,11 +61,11 @@ struct https_sync_connection
6861
long ssl_options =0)
6962
: connection_base(),
7063
timeout_(timeout),
71-
timer_(GET_IO_SERVICE(resolver)),
64+
timer_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver)),
7265
resolver_(resolver),
7366
resolve_(std::move(resolve)),
74-
context_(GET_IO_SERVICE(resolver), boost::asio::ssl::context::sslv23_client),
75-
socket_(GET_IO_SERVICE(resolver), context_) {
67+
context_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver), boost::asio::ssl::context::sslv23_client),
68+
socket_(CPP_NETLIB_ASIO_GET_IO_SERVICE(resolver), context_) {
7669
if (ciphers) {
7770
::SSL_CTX_set_cipher_list(context_.native_handle(), ciphers->c_str());
7871
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp