mirror of
https://codeberg.org/wownero/wownero-lws
synced 2026-01-11 08:05:16 -08:00
Update boost::asio usage to conform to newer standards: (#144)
* Convert boost::asio::io_service to boost::asio::io_context * Convert strand.wrap(...) to boost::asio::bind_executor(strand, ...) * Convert strand.dispatch(...) to boost::asio::dispatch(strand, ...) * Convert io_context.reset() to io_context.restart() * Convert null_buffers() usage to socket.async_wait(...) * Drop usage of GET_IO_SERVICE macro from monero * Refactor REST server to manage resources better
This commit is contained in:
committed by
Lee *!* Clagett
parent
5796dad3b8
commit
66b7497a34
@@ -26,6 +26,7 @@
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#pragma once
|
||||
|
||||
#include <boost/asio/bind_executor.hpp>
|
||||
#include <boost/asio/coroutine.hpp>
|
||||
#include <boost/asio/dispatch.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
@@ -118,8 +119,10 @@ namespace lws { namespace rpc { namespace scanner
|
||||
while (!self_->write_bufs_.empty())
|
||||
{
|
||||
self_->write_timeout_.expires_from_now(std::chrono::seconds{10});
|
||||
self_->write_timeout_.async_wait(self_->strand_.wrap(timeout<T>{self_}));
|
||||
BOOST_ASIO_CORO_YIELD boost::asio::async_write(self_->sock_, self_->write_buffer(), self_->strand_.wrap(*this));
|
||||
self_->write_timeout_.async_wait(boost::asio::bind_executor(self_->strand_, timeout<T>{self_}));
|
||||
BOOST_ASIO_CORO_YIELD boost::asio::async_write(
|
||||
self_->sock_, self_->write_buffer(), boost::asio::bind_executor(self_->strand_, *this)
|
||||
);
|
||||
self_->write_timeout_.cancel();
|
||||
self_->write_bufs_.pop_front();
|
||||
}
|
||||
@@ -205,6 +208,6 @@ namespace lws { namespace rpc { namespace scanner
|
||||
}
|
||||
};
|
||||
|
||||
self->strand_.dispatch(queue_slice{self, std::move(msg)});
|
||||
boost::asio::dispatch(self->strand_, queue_slice{self, std::move(msg)});
|
||||
}
|
||||
}}} // lws // rpc // scanner
|
||||
|
||||
Reference in New Issue
Block a user