You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some background, I'm trying to use boost::beast with my own executor, based on the minimal example here.
However, it seems like something inside beast's websocket is doing something funny with the executor's require interface, and leading to compile errors.
For example, imagine a simple executor that's merely a forwarder to asio::io_context:
Creating sockets with this executor works just fine:
using socket_t = boost::asio::basic_stream_socket<boost::asio::ip::tcp, common::base::executor>;
...
auto p = std::make_shared<socket_t>(executor{&ioc_from_somewhere});
But creating websockets leads to compile errors (for example, in handshake):
using websocket_t = boost::beast::websocket::stream<socket_t, true>;
...
auto p = std::make_shared<websocket_t>(executor{&ioc_from_somewhere});
p->async_handshake("host", "target", [](boost::system::error_code ec){});
...compile....
boost/asio/associated_immediate_executor.hpp:57:12: error: binding reference of type 'executor' to value of type 'const executor' drops 'const' qualifier
57 | return boost::asio::require(e, execution::blocking.never);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The require api is admittedly super clunky, so it's not at all clear what else the executor needs to make beast happy.
The text was updated successfully, but these errors were encountered:
asio::io_context ioc;
auto e = asio::get_associated_immediate_executor([] {}, executor{ &ioc });
It seems we need to check for the existence of the associated immediate executor before attempting to use it in a dispatch operation. There is a possibility that this might be a bug in Asio as well, which I am currently investigating.
This seems to be a bug in Asio. I've made a pull request for it: chriskohlhoff/asio#1465
As a workaround you might consider commenting out the static query(asio::execution::blocking_t) member function:
Beast 351 from boost 1.84
For some background, I'm trying to use boost::beast with my own executor, based on the minimal example here.
However, it seems like something inside beast's websocket is doing something funny with the executor's require interface, and leading to compile errors.
For example, imagine a simple executor that's merely a forwarder to
asio::io_context
:Creating sockets with this executor works just fine:
But creating websockets leads to compile errors (for example, in handshake):
The require api is admittedly super clunky, so it's not at all clear what else the executor needs to make beast happy.
The text was updated successfully, but these errors were encountered: