This is an automated email from the ASF dual-hosted git repository.
maskit pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push:
new 877d9ff Fix a crash on idle timeout
877d9ff is described below
commit 877d9ff1f2f867ca184e83fae4fde41ec1d8c910
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Fri Dec 1 16:29:10 2017 +0900
Fix a crash on idle timeout
---
iocore/net/P_QUICNetVConnection.h | 4 +++-
iocore/net/QUICNetVConnection.cc | 39 +++++++++++++++++++++------------------
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/iocore/net/P_QUICNetVConnection.h
b/iocore/net/P_QUICNetVConnection.h
index c80a2b6..77b13f1 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -260,9 +260,11 @@ private:
int _complete_handshake_if_possible();
void _switch_to_handshake_state();
void _switch_to_established_state();
- void _switch_to_closing_state();
+ void _switch_to_closing_state(QUICConnectionErrorUPtr error);
void _switch_to_close_state();
+ void _handle_idle_timeout();
+
QUICStatelessToken _token;
};
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 9522cc3..97ec7b6 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -302,12 +302,7 @@ QUICNetVConnection::close(QUICConnectionErrorUPtr error)
this->handler ==
reinterpret_cast<ContinuationHandler>(&QUICNetVConnection::state_connection_closing))
{
// do nothing
} else {
- this->_switch_to_closing_state();
- if (error->cls == QUICErrorClass::APPLICATION) {
-
this->transmit_frame(QUICFrameFactory::create_application_close_frame(std::move(error)));
- } else {
-
this->transmit_frame(QUICFrameFactory::create_connection_close_frame(std::move(error)));
- }
+ this->_switch_to_closing_state(std::move(error));
}
}
@@ -403,11 +398,8 @@ QUICNetVConnection::state_handshake(int event, Event *data)
break;
}
case EVENT_IMMEDIATE:
- // Start Implicit Shutdown. Because of no network activity for the
duration of the idle timeout.
- this->remove_from_active_queue();
- this->close(std::make_unique<QUICConnectionError>());
-
- // TODO: signal VC_EVENT_ACTIVE_TIMEOUT/VC_EVENT_INACTIVITY_TIMEOUT to
application
+ // Start Immediate Close because of Idle Timeout
+ this->_handle_idle_timeout();
break;
default:
DebugQUICCon("Unexpected event: %s", QUICDebugNames::quic_event(event));
@@ -436,11 +428,8 @@ QUICNetVConnection::state_connection_established(int
event, Event *data)
break;
}
case EVENT_IMMEDIATE: {
- // Start Implicit Shutdown. Because of no network activity for the
duration of the idle timeout.
- this->remove_from_active_queue();
- this->close(std::make_unique<QUICConnectionError>());
-
- // TODO: signal VC_EVENT_ACTIVE_TIMEOUT/VC_EVENT_INACTIVITY_TIMEOUT to
application
+ // Start Immediate Close because of Idle Timeout
+ this->_handle_idle_timeout();
break;
}
default:
@@ -479,7 +468,7 @@ QUICNetVConnection::state_connection_closing(int event,
Event *data)
DebugQUICCon("Unexpected event: %s", QUICDebugNames::quic_event(event));
}
- // FIXME Enter closed state if CONNECTION_CLOSE was ACKed
+ // FIXME Enter closed state if CONNECTION_CLOSE was ACKed and draining
period end
if (true) {
this->_switch_to_close_state();
}
@@ -1020,11 +1009,16 @@ QUICNetVConnection::_switch_to_established_state()
}
void
-QUICNetVConnection::_switch_to_closing_state()
+QUICNetVConnection::_switch_to_closing_state(QUICConnectionErrorUPtr error)
{
if (this->_complete_handshake_if_possible() != 0) {
DebugQUICCon("Switching state without handshake completion");
}
+ if (error->cls == QUICErrorClass::APPLICATION) {
+
this->transmit_frame(QUICFrameFactory::create_application_close_frame(std::move(error)));
+ } else {
+
this->transmit_frame(QUICFrameFactory::create_connection_close_frame(std::move(error)));
+ }
DebugQUICCon("Enter state_connection_closing");
SET_HANDLER((NetVConnHandler)&QUICNetVConnection::state_connection_closing);
}
@@ -1039,3 +1033,12 @@ QUICNetVConnection::_switch_to_close_state()
SET_HANDLER((NetVConnHandler)&QUICNetVConnection::state_connection_closed);
this_ethread()->schedule_imm(this, QUIC_EVENT_SHUTDOWN, nullptr);
}
+
+void
+QUICNetVConnection::_handle_idle_timeout()
+{
+ this->remove_from_active_queue();
+
this->close(std::make_unique<QUICConnectionError>(QUICTransErrorCode::NO_ERROR,
"Idle Timeout"));
+
+ // TODO: signal VC_EVENT_ACTIVE_TIMEOUT/VC_EVENT_INACTIVITY_TIMEOUT to
application
+}
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].