Skip to content

Commit

Permalink
Fix a crash on active timeout on QUIC connections (apache#7059)
Browse files Browse the repository at this point in the history
This closes apache#7042
  • Loading branch information
maskit authored and whutwhu committed Nov 1, 2020
1 parent dbba742 commit e220818
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions iocore/net/P_QUICNetVConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
20 changes: 20 additions & 0 deletions iocore/net/QUICNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<QUICConnectionError>(QUICTransErrorCode::NO_ERROR, "Active Timeout"));
}

void
QUICNetVConnection::_validate_new_path(const QUICPath &path)
{
Expand Down

0 comments on commit e220818

Please sign in to comment.