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

Commit5351fc6

Browse files
committed
Fix for boost 1.70 (get_io_service() was deprecated and was removed)
1 parentcf11364 commit5351fc6

File tree

5 files changed

+46
-9
lines changed

5 files changed

+46
-9
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
#include<boost/network/protocol/http/traits/resolver_policy.hpp>
1818
#include<boost/network/traits/string.hpp>
1919

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
27+
2028
namespaceboost {
2129
namespacenetwork {
2230
namespacehttp {
@@ -59,7 +67,7 @@ struct async_connection_base {
5967
async_connection;
6068
typedeftypename delegate_factory<Tag>::type delegate_factory_type;
6169
auto delegate =delegate_factory_type::new_connection_delegate(
62-
(boost::asio::io_context &)resolver.get_executor().context(), https, always_verify_peer,
70+
GET_IO_SERVICE(resolver), https, always_verify_peer,
6371
certificate_filename, verify_path, certificate_file, private_key_file,
6472
ciphers, sni_hostname, ssl_options);
6573
auto temp = std::make_shared<async_connection>(

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
#include<boost/range/iterator_range.hpp>
3434
#include<boost/throw_exception.hpp>
3535

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
43+
3644
namespaceboost {
3745
namespacenetwork {
3846
namespacehttp {
@@ -154,12 +162,12 @@ struct http_async_connection
154162
connection_delegate_ptr delegate)
155163
: timeout_(timeout),
156164
remove_chunk_markers_(remove_chunk_markers),
157-
timer_((boost::asio::io_context &)resolver.get_executor().context()),
165+
timer_(GET_IO_SERVICE(resolver)),
158166
is_timedout_(false),
159167
follow_redirect_(follow_redirect),
160168
resolver_(resolver),
161169
resolve_(std::move(resolve)),
162-
request_strand_((boost::asio::io_context &)resolver.get_executor().context()),
170+
request_strand_(GET_IO_SERVICE(resolver)),
163171
delegate_(std::move(delegate)) {}
164172

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

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ struct connection_delegate_factory {
3434
// This is the factory method that actually returns the delegate instance.
3535
// TODO(dberris): Support passing in proxy settings when crafting connections.
3636
static connection_delegate_ptrnew_connection_delegate(
37-
boost::asio::io_context& service,bool https,bool always_verify_peer,
37+
#if BOOST_VERSION >= 107000
38+
boost::asio::io_context& service,
39+
#else
40+
boost::asio::io_service& service,
41+
#endif
42+
bool https,bool always_verify_peer,
3843
optional<string_type> certificate_filename,
3944
optional<string_type> verify_path, optional<string_type> certificate_file,
4045
optional<string_type> private_key_file, optional<string_type> ciphers,

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
#include<boost/network/protocol/http/traits/resolver_policy.hpp>
1818
#include<boost/network/traits/string.hpp>
1919

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
27+
2028
namespaceboost {
2129
namespacenetwork {
2230
namespacehttp {
@@ -49,10 +57,10 @@ struct http_sync_connection
4957
int timeout)
5058
: connection_base(),
5159
timeout_(timeout),
52-
timer_((boost::asio::io_context &)resolver.get_executor().context()),
60+
timer_(GET_IO_SERVICE(resolver)),
5361
resolver_(resolver),
5462
resolve_(std::move(resolve)),
55-
socket_((boost::asio::io_context &)resolver.get_executor().context()) {}
63+
socket_(GET_IO_SERVICE(resolver)) {}
5664

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

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
#include<boost/network/protocol/http/request.hpp>
1818
#include<boost/network/protocol/http/traits/resolver_policy.hpp>
1919

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
27+
2028
namespaceboost {
2129
namespacenetwork {
2230
namespacehttp {
@@ -60,11 +68,11 @@ struct https_sync_connection
6068
long ssl_options =0)
6169
: connection_base(),
6270
timeout_(timeout),
63-
timer_((boost::asio::io_context &)resolver.get_executor().context()),
71+
timer_(GET_IO_SERVICE(resolver)),
6472
resolver_(resolver),
6573
resolve_(std::move(resolve)),
66-
context_((boost::asio::io_context &)resolver.get_executor().context(), boost::asio::ssl::context::sslv23_client),
67-
socket_((boost::asio::io_context &)resolver.get_executor().context(), context_) {
74+
context_(GET_IO_SERVICE(resolver), boost::asio::ssl::context::sslv23_client),
75+
socket_(GET_IO_SERVICE(resolver), context_) {
6876
if (ciphers) {
6977
::SSL_CTX_set_cipher_list(context_.native_handle(), ciphers->c_str());
7078
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp