mirror of
https://github.com/holub/mame
synced 2025-06-13 16:15:32 +03:00
Actually commit the source changes for ASIO 1.20.0 update.
Also changed the fix to ASIO itself to match the upstream change in commit cd68912b7eb07f24e501e8cbff832b61ec292eea.
This commit is contained in:
parent
44ec6d2e0e
commit
f570febfa1
@ -53,8 +53,8 @@ public:
|
|||||||
protocol_(protocol),
|
protocol_(protocol),
|
||||||
peer_endpoint_(peer_endpoint),
|
peer_endpoint_(peer_endpoint),
|
||||||
enable_connection_aborted_(enable_connection_aborted),
|
enable_connection_aborted_(enable_connection_aborted),
|
||||||
cancel_requested_(0),
|
|
||||||
proxy_op_(0),
|
proxy_op_(0),
|
||||||
|
cancel_requested_(0),
|
||||||
handler_(ASIO_MOVE_CAST(Handler)(handler)),
|
handler_(ASIO_MOVE_CAST(Handler)(handler)),
|
||||||
work_(handler_, io_ex)
|
work_(handler_, io_ex)
|
||||||
{
|
{
|
||||||
|
@ -331,7 +331,7 @@ http_manager::http_manager(bool active, short port, const char *root)
|
|||||||
};
|
};
|
||||||
|
|
||||||
m_server->on_upgrade = [this](auto socket, auto request) {
|
m_server->on_upgrade = [this](auto socket, auto request) {
|
||||||
auto connection = std::make_shared<webpp::ws_server::Connection>(socket);
|
auto connection = std::make_shared<webpp::ws_server::Connection>(*m_io_context, socket);
|
||||||
connection->method = std::move(request->method);
|
connection->method = std::move(request->method);
|
||||||
connection->path = std::move(request->path);
|
connection->path = std::move(request->path);
|
||||||
connection->http_version = std::move(request->http_version);
|
connection->http_version = std::move(request->http_version);
|
||||||
|
@ -74,10 +74,10 @@ namespace webpp {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~Connection() {}
|
virtual ~Connection() {}
|
||||||
explicit Connection(const std::shared_ptr<socket_type> &socket) : super(0), socket(socket), strand(socket->get_io_service()), closed(false) { }
|
Connection(asio::io_context &context, const std::shared_ptr<socket_type> &socket) : super(0), socket(socket), strand(context), closed(false) { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Connection(socket_type *socket): super(0), socket(socket), strand(socket->get_io_service()), closed(false) { }
|
Connection(asio::io_context &context, socket_type *socket): super(0), socket(socket), strand(context), closed(false) { }
|
||||||
|
|
||||||
class SendData {
|
class SendData {
|
||||||
public:
|
public:
|
||||||
@ -361,7 +361,7 @@ namespace webpp {
|
|||||||
std::shared_ptr<asio::system_timer> get_timeout_timer(const std::shared_ptr<Connection> &connection, size_t seconds) {
|
std::shared_ptr<asio::system_timer> get_timeout_timer(const std::shared_ptr<Connection> &connection, size_t seconds) {
|
||||||
if (seconds == 0)
|
if (seconds == 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
auto timer = std::make_shared<asio::system_timer>(connection->socket->get_io_service());
|
auto timer = std::make_shared<asio::system_timer>(connection->socket->get_executor());
|
||||||
timer->expires_at(std::chrono::system_clock::now() + std::chrono::seconds(static_cast<long>(seconds)));
|
timer->expires_at(std::chrono::system_clock::now() + std::chrono::seconds(static_cast<long>(seconds)));
|
||||||
timer->async_wait([connection](const std::error_code& ec){
|
timer->async_wait([connection](const std::error_code& ec){
|
||||||
if(!ec) {
|
if(!ec) {
|
||||||
@ -652,7 +652,7 @@ namespace webpp {
|
|||||||
|
|
||||||
void timer_idle_init(const std::shared_ptr<Connection> &connection) {
|
void timer_idle_init(const std::shared_ptr<Connection> &connection) {
|
||||||
if(config.timeout_idle>0) {
|
if(config.timeout_idle>0) {
|
||||||
connection->timer_idle= std::make_unique<asio::system_timer>(connection->socket->get_io_service());
|
connection->timer_idle= std::make_unique<asio::system_timer>(connection->socket->get_executor());
|
||||||
connection->timer_idle->expires_from_now(std::chrono::seconds(static_cast<unsigned long>(config.timeout_idle)));
|
connection->timer_idle->expires_from_now(std::chrono::seconds(static_cast<unsigned long>(config.timeout_idle)));
|
||||||
timer_idle_expired_function(connection);
|
timer_idle_expired_function(connection);
|
||||||
}
|
}
|
||||||
@ -693,7 +693,7 @@ namespace webpp {
|
|||||||
void accept() override {
|
void accept() override {
|
||||||
//Create new socket for this connection (stored in Connection::socket)
|
//Create new socket for this connection (stored in Connection::socket)
|
||||||
//Shared_ptr is used to pass temporary objects to the asynchronous functions
|
//Shared_ptr is used to pass temporary objects to the asynchronous functions
|
||||||
std::shared_ptr<Connection> connection(new Connection(new WS(*io_context)));
|
std::shared_ptr<Connection> connection(new Connection(*io_context, new WS(*io_context)));
|
||||||
|
|
||||||
acceptor->async_accept(*connection->socket, [this, connection](const std::error_code& ec) {
|
acceptor->async_accept(*connection->socket, [this, connection](const std::error_code& ec) {
|
||||||
//Immediately start accepting a new connection (if io_context hasn't been stopped)
|
//Immediately start accepting a new connection (if io_context hasn't been stopped)
|
||||||
|
Loading…
Reference in New Issue
Block a user