Skip to content

Commit

Permalink
Rename get_io_service methods
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er committed Jan 6, 2025
1 parent f76833b commit a8a8b62
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/crow/http_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ namespace crow
ctx_ = detail::context<Middlewares...>();
req_.middleware_context = static_cast<void*>(&ctx_);
req_.middleware_container = static_cast<void*>(middlewares_);
req_.io_context = &adaptor_.get_io_service();
req_.io_context = &adaptor_.get_io_context();

req_.remote_ip_address = adaptor_.remote_endpoint().address().to_string();

Expand Down
12 changes: 6 additions & 6 deletions include/crow/socket_adaptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include "crow/settings.h"

#if (CROW_USE_BOOST && BOOST_VERSION >= 107000) || (ASIO_VERSION >= 101300)
#define GET_IO_SERVICE(s) ((asio::io_context&)(s).get_executor().context())
#define GET_IO_CONTEXT(s) ((asio::io_context&)(s).get_executor().context())
#else
#define GET_IO_SERVICE(s) ((s).get_io_service())
#define GET_IO_CONTEXT(s) ((s).get_io_service())
#endif

namespace crow
Expand All @@ -42,9 +42,9 @@ namespace crow
socket_(io_context)
{}

asio::io_context& get_io_service()
asio::io_context& get_io_context()
{
return GET_IO_SERVICE(socket_);
return GET_IO_CONTEXT(socket_);
}

/// Get the TCP socket handling data trasfers, regardless of what layer is handling transfers on top of the socket.
Expand Down Expand Up @@ -168,9 +168,9 @@ namespace crow
}
}

asio::io_context& get_io_service()
asio::io_context& get_io_context()
{
return GET_IO_SERVICE(raw_socket());
return GET_IO_CONTEXT(raw_socket());
}

template<typename F>
Expand Down
4 changes: 2 additions & 2 deletions include/crow/websocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
template<typename CompletionHandler>
void dispatch(CompletionHandler&& handler)
{
asio::dispatch(adaptor_.get_io_service(),
asio::dispatch(adaptor_.get_io_context(),
WeakWrappedMessage<typename std::decay<CompletionHandler>::type>{
std::forward<CompletionHandler>(handler), anchor_});
}
Expand All @@ -211,7 +211,7 @@ namespace crow // NOTE: Already documented in "crow/app.h"
template<typename CompletionHandler>
void post(CompletionHandler&& handler)
{
asio::post(adaptor_.get_io_service(),
asio::post(adaptor_.get_io_context(),
WeakWrappedMessage<typename std::decay<CompletionHandler>::type>{
std::forward<CompletionHandler>(handler), anchor_});
}
Expand Down

0 comments on commit a8a8b62

Please sign in to comment.