mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
adds more robust proxy timeout behavior
This commit is contained in:
@@ -457,6 +457,7 @@ protected:
|
||||
} else {
|
||||
m_alog.write(log::alevel::devel,
|
||||
"asio handle_proxy_write timer expired");
|
||||
socket_con_type::cancel_socket();
|
||||
callback(make_error_code(transport::error::timeout));
|
||||
}
|
||||
}
|
||||
@@ -469,14 +470,25 @@ protected:
|
||||
}
|
||||
|
||||
m_bufs.clear();
|
||||
|
||||
|
||||
// Timer expired or the operation was aborted for some reason.
|
||||
// Whatever aborted it will be issuing the callback so we are safe to
|
||||
// return
|
||||
if (ec == boost::asio::error::operation_aborted ||
|
||||
m_proxy_data->timer->expires_from_now().is_negative())
|
||||
{
|
||||
m_elog.write(log::elevel::devel,"write operation aborted");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ec) {
|
||||
log_err(log::elevel::info,"asio handle_proxy_write",ec);
|
||||
m_proxy_data->timer->cancel();
|
||||
callback(make_error_code(error::pass_through));
|
||||
} else {
|
||||
proxy_read(callback);
|
||||
callback(make_error_code(error::pass_through));
|
||||
return;
|
||||
}
|
||||
|
||||
proxy_read(callback);
|
||||
}
|
||||
|
||||
void proxy_read(init_handler callback) {
|
||||
@@ -513,6 +525,16 @@ protected:
|
||||
m_alog.write(log::alevel::devel,"asio connection handle_proxy_read");
|
||||
}
|
||||
|
||||
// Timer expired or the operation was aborted for some reason.
|
||||
// Whatever aborted it will be issuing the callback so we are safe to
|
||||
// return
|
||||
if (ec == boost::asio::error::operation_aborted ||
|
||||
m_proxy_data->timer->expires_from_now().is_negative())
|
||||
{
|
||||
m_elog.write(log::elevel::devel,"read operation aborted");
|
||||
return;
|
||||
}
|
||||
|
||||
// At this point there is no need to wait for the timer anymore
|
||||
m_proxy_data->timer->cancel();
|
||||
|
||||
|
||||
@@ -204,7 +204,12 @@ protected:
|
||||
void set_handle(connection_hdl hdl) {
|
||||
m_hdl = hdl;
|
||||
}
|
||||
|
||||
|
||||
/// Cancel all async operations on this socket
|
||||
void cancel_socket() {
|
||||
m_socket->cancel();
|
||||
}
|
||||
|
||||
void async_shutdown(socket_shutdown_handler h) {
|
||||
boost::system::error_code ec;
|
||||
m_socket->shutdown(boost::asio::ip::tcp::socket::shutdown_both,ec);
|
||||
|
||||
@@ -291,6 +291,11 @@ protected:
|
||||
callback(lib::error_code());
|
||||
}
|
||||
|
||||
/// Cancel all async operations on this socket
|
||||
void cancel_socket() {
|
||||
get_raw_socket().cancel();
|
||||
}
|
||||
|
||||
void async_shutdown(socket_shutdown_handler h) {
|
||||
m_socket->async_shutdown(
|
||||
lib::bind(
|
||||
|
||||
Reference in New Issue
Block a user