Skip to content

Commit a11fa6f

Browse files
committed
replaced uses of boost::asio::io_context::strand::wrap with boost::asio::bind_executor to avoid future deprecation issues
1 parent 0964874 commit a11fa6f

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

websocketpp/transport/asio/connection.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class connection : public config::socket_type::socket_con_type {
324324
);
325325

326326
if (config::enable_multithreading) {
327-
new_timer->async_wait(m_strand->wrap(lib::bind(
327+
new_timer->async_wait(lib::asio::bind_executor(*m_strand, lib::bind(
328328
&type::handle_timer, get_shared(),
329329
new_timer,
330330
callback,
@@ -635,7 +635,7 @@ class connection : public config::socket_type::socket_con_type {
635635
lib::asio::async_write(
636636
socket_con_type::get_next_layer(),
637637
m_bufs,
638-
m_strand->wrap(lib::bind(
638+
lib::asio::bind_executor(*m_strand, lib::bind(
639639
&type::handle_proxy_write, get_shared(),
640640
callback,
641641
lib::placeholders::_1
@@ -718,7 +718,7 @@ class connection : public config::socket_type::socket_con_type {
718718
socket_con_type::get_next_layer(),
719719
m_proxy_data->read_buf,
720720
"\r\n\r\n",
721-
m_strand->wrap(lib::bind(
721+
lib::asio::bind_executor(*m_strand, lib::bind(
722722
&type::handle_proxy_read, get_shared(),
723723
callback,
724724
lib::placeholders::_1, lib::placeholders::_2
@@ -856,7 +856,7 @@ class connection : public config::socket_type::socket_con_type {
856856
socket_con_type::get_socket(),
857857
lib::asio::buffer(buf,len),
858858
lib::asio::transfer_at_least(num_bytes),
859-
m_strand->wrap(make_custom_alloc_handler(
859+
lib::asio::bind_executor(*m_strand, make_custom_alloc_handler(
860860
m_read_handler_allocator,
861861
lib::bind(
862862
&type::handle_async_read, get_shared(),
@@ -925,7 +925,7 @@ class connection : public config::socket_type::socket_con_type {
925925
lib::asio::async_write(
926926
socket_con_type::get_socket(),
927927
m_bufs,
928-
m_strand->wrap(make_custom_alloc_handler(
928+
lib::asio::bind_executor(*m_strand, make_custom_alloc_handler(
929929
m_write_handler_allocator,
930930
lib::bind(
931931
&type::handle_async_write, get_shared(),
@@ -965,7 +965,7 @@ class connection : public config::socket_type::socket_con_type {
965965
lib::asio::async_write(
966966
socket_con_type::get_socket(),
967967
m_bufs,
968-
m_strand->wrap(make_custom_alloc_handler(
968+
lib::asio::bind_executor(*m_strand, make_custom_alloc_handler(
969969
m_write_handler_allocator,
970970
lib::bind(
971971
&type::handle_async_write, get_shared(),
@@ -1030,7 +1030,7 @@ class connection : public config::socket_type::socket_con_type {
10301030
*/
10311031
lib::error_code interrupt(interrupt_handler handler) {
10321032
if (config::enable_multithreading) {
1033-
lib::asio::post(m_io_context->get_executor(), m_strand->wrap(handler));
1033+
lib::asio::post(m_io_context->get_executor(), lib::asio::bind_executor(*m_strand, handler));
10341034
} else {
10351035
lib::asio::post(m_io_context->get_executor(), handler);
10361036
}
@@ -1039,7 +1039,7 @@ class connection : public config::socket_type::socket_con_type {
10391039

10401040
lib::error_code dispatch(dispatch_handler handler) {
10411041
if (config::enable_multithreading) {
1042-
lib::asio::post(m_io_context->get_executor(), m_strand->wrap(handler));
1042+
lib::asio::post(m_io_context->get_executor(), lib::asio::bind_executor(*m_strand, handler));
10431043
} else {
10441044
lib::asio::post(m_io_context->get_executor(), handler);
10451045
}

websocketpp/transport/asio/endpoint.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ class endpoint : public config::socket_type {
802802
if (config::enable_multithreading) {
803803
m_acceptor->async_accept(
804804
tcon->get_raw_socket(),
805-
tcon->get_strand()->wrap(lib::bind(
805+
lib::asio::bind_executor(*tcon->get_strand(), lib::bind(
806806
&type::handle_accept,
807807
this,
808808
callback,
@@ -930,7 +930,7 @@ class endpoint : public config::socket_type {
930930
m_resolver->async_resolve(
931931
host,
932932
port,
933-
tcon->get_strand()->wrap(lib::bind(
933+
lib::asio::bind_executor(*tcon->get_strand(), lib::bind(
934934
&type::handle_resolve,
935935
this,
936936
tcon,
@@ -1040,7 +1040,7 @@ class endpoint : public config::socket_type {
10401040
lib::asio::async_connect(
10411041
tcon->get_raw_socket(),
10421042
results,
1043-
tcon->get_strand()->wrap(lib::bind(
1043+
lib::asio::bind_executor(*tcon->get_strand(), lib::bind(
10441044
&type::handle_connect,
10451045
this,
10461046
tcon,

websocketpp/transport/asio/security/tls.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class connection : public lib::enable_shared_from_this<connection> {
277277
if (m_strand) {
278278
m_socket->async_handshake(
279279
get_handshake_type(),
280-
m_strand->wrap(lib::bind(
280+
lib::asio::bind_executor(*m_strand, lib::bind(
281281
&type::handle_init, get_shared(),
282282
callback,
283283
lib::placeholders::_1
@@ -337,7 +337,7 @@ class connection : public lib::enable_shared_from_this<connection> {
337337

338338
void async_shutdown(socket::shutdown_handler callback) {
339339
if (m_strand) {
340-
m_socket->async_shutdown(m_strand->wrap(callback));
340+
m_socket->async_shutdown(lib::asio::bind_executor(*m_strand, callback));
341341
} else {
342342
m_socket->async_shutdown(callback);
343343
}

0 commit comments

Comments
 (0)