From 63f8886289a5c787692bc23cb81342a2474cde7a Mon Sep 17 00:00:00 2001 From: Masakazu Kitajo Date: Wed, 29 Jul 2020 12:09:05 +0900 Subject: [PATCH] Fix a crash on active timeout on QUIC connections This closes #7042 --- iocore/net/P_QUICNetVConnection.h | 1 + iocore/net/QUICNetVConnection.cc | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h index a7aee81831d..a3f24a42e8c 100644 --- a/iocore/net/P_QUICNetVConnection.h +++ b/iocore/net/P_QUICNetVConnection.h @@ -349,6 +349,7 @@ class QUICNetVConnection : public UnixNetVConnection, void _handle_periodic_ack_event(); void _handle_idle_timeout(); + void _handle_active_timeout(); QUICConnectionErrorUPtr _handle_frame(const QUICNewConnectionIdFrame &frame); diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc index a557303e5b1..8d458ce0de8 100644 --- a/iocore/net/QUICNetVConnection.cc +++ b/iocore/net/QUICNetVConnection.cc @@ -838,6 +838,10 @@ QUICNetVConnection::state_handshake(int event, Event *data) // Start Immediate Close because of Idle Timeout this->_handle_idle_timeout(); break; + case VC_EVENT_ACTIVE_TIMEOUT: + // Start Immediate Close + this->_handle_active_timeout(); + break; default: QUICConDebug("Unexpected event: %s (%d)", QUICDebugNames::quic_event(event), event); } @@ -874,6 +878,10 @@ QUICNetVConnection::state_connection_established(int event, Event *data) // Start Immediate Close because of Idle Timeout this->_handle_idle_timeout(); break; + case VC_EVENT_ACTIVE_TIMEOUT: + // Start Immediate Close + this->_handle_active_timeout(); + break; default: QUICConDebug("Unexpected event: %s (%d)", QUICDebugNames::quic_event(event), event); } @@ -906,6 +914,9 @@ QUICNetVConnection::state_connection_closing(int event, Event *data) break; case QUIC_EVENT_STATELESS_RESET: break; + case VC_EVENT_ACTIVE_TIMEOUT: + // Do nothing because closing is in progress + break; case QUIC_EVENT_ACK_PERIODIC: default: QUICConDebug("Unexpected event: %s (%d)", QUICDebugNames::quic_event(event), event); @@ -936,6 +947,9 @@ QUICNetVConnection::state_connection_draining(int event, Event *data) break; case QUIC_EVENT_STATELESS_RESET: break; + case VC_EVENT_ACTIVE_TIMEOUT: + // Do nothing because closing is in progress + break; case QUIC_EVENT_ACK_PERIODIC: default: QUICConDebug("Unexpected event: %s (%d)", QUICDebugNames::quic_event(event), event); @@ -2177,6 +2191,12 @@ QUICNetVConnection::_handle_idle_timeout() // TODO: signal VC_EVENT_ACTIVE_TIMEOUT/VC_EVENT_INACTIVITY_TIMEOUT to application } +void +QUICNetVConnection::_handle_active_timeout() +{ + this->close_quic_connection(std::make_unique(QUICTransErrorCode::NO_ERROR, "Active Timeout")); +} + void QUICNetVConnection::_validate_new_path(const QUICPath &path) {