Note: Not sure if this is due to Asio bug, Azmq bug or my own ignorance.
I am using an Azmq library to read off a socket, this library uses its own type of socket (azmq::socket) which I am pretty sure is a wrapper for a boost::asio::socket. The flow of execution is the following:
auto val = co_await(azmq::async_receive(socket_, asio::buffer(buffer), asio::use_awaitable) || timer(std::chrono::seconds{1}));
template<typename MessageReadHandler>
void async_receive(MessageReadHandler && handler, flags_type flags = 0) {
using type = detail::receive_op<MessageReadHandler>;
get_service().enqueue<type>(get_implementation(), detail::socket_service::op_type::read_op, std::forward<MessageReadHandler>(handler), flags);
}
The problem arises when the timer fires, the async_receive is not cancelled. I have read the Asio documentation but to no avail. What is the problem? Is the async_receive missing a method on it? I have tried to read up on what actually happens when the operation is cancelled but I have not found much. All help is appreciated.
I have written up this problem with tcp socket and have determined that the issue is contained to azmq sockets and therefore not an issue with Boost.Asio.
Note: Not sure if this is due to Asio bug, Azmq bug or my own ignorance.
I am using an Azmq library to read off a socket, this library uses its own type of socket (azmq::socket) which I am pretty sure is a wrapper for a boost::asio::socket. The flow of execution is the following:
The problem arises when the timer fires, the async_receive is not cancelled. I have read the Asio documentation but to no avail. What is the problem? Is the async_receive missing a method on it? I have tried to read up on what actually happens when the operation is cancelled but I have not found much. All help is appreciated.