You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/01/15 08:08:48 UTC
[trafficserver] branch quic-latest updated: Draining period and
closing period can share the same timer
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 c147874 Draining period and closing period can share the same timer
c147874 is described below
commit c147874b6c051944845be9931ef13f9a304f8968
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Mon Jan 15 17:07:00 2018 +0900
Draining period and closing period can share the same timer
---
iocore/net/P_QUICNetVConnection.h | 8 +++----
iocore/net/QUICNetVConnection.cc | 48 +++++++++++++++++++++------------------
iocore/net/quic/QUICDebugNames.cc | 4 ++--
iocore/net/quic/QUICEvents.h | 2 +-
4 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h
index a040ca2..d076fd3 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -256,10 +256,10 @@ private:
void _close_packet_write_ready(Event *data);
Event *_packet_write_ready = nullptr;
- void _schedule_draining_timeout(ink_hrtime interval);
- void _unschedule_draining_timeout();
- void _close_draining_timeout(Event *data);
- Event *_draining_timeout = nullptr;
+ void _schedule_closing_timeout(ink_hrtime interval);
+ void _unschedule_closing_timeout();
+ void _close_closing_timeout(Event *data);
+ Event *_closing_timeout = nullptr;
uint32_t _transmit_packet(QUICPacketUPtr);
void _transmit_frame(QUICFrameUPtr);
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index df1afe1..582d372 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -479,28 +479,33 @@ int
QUICNetVConnection::state_connection_closing(int event, Event *data)
{
SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
+ bool can_switch_to_close_state = false;
QUICErrorUPtr error = QUICErrorUPtr(new QUICNoError());
switch (event) {
- case QUIC_EVENT_PACKET_READ_READY: {
+ case QUIC_EVENT_PACKET_READ_READY:
if (this->_handshake_handler && this->_handshake_handler->is_completed()) {
error = this->_state_common_receive_packet();
+ // TODO receiving a closing frame is sufficient confirmation
+ // can_switch_to_close_state = true;
} else {
// FIXME Just ignore for now but it has to be acked (GitHub#2609)
}
break;
- }
- case QUIC_EVENT_PACKET_WRITE_READY: {
+ case QUIC_EVENT_PACKET_WRITE_READY:
this->_close_packet_write_ready(data);
+ // FIXME Only closing frames are allowed to send
this->_state_common_send_packet();
break;
- }
+ case QUIC_EVENT_CLOSING_TIMEOUT:
+ this->_close_closing_timeout(data);
+ can_switch_to_close_state = true;
+ break;
default:
QUICConDebug("Unexpected event: %s", QUICDebugNames::quic_event(event));
}
- // FIXME Enter closed state if CONNECTION_CLOSE was ACKed and draining period end
- if (true) {
+ if (can_switch_to_close_state) {
this->_switch_to_close_state();
}
@@ -529,15 +534,14 @@ QUICNetVConnection::state_connection_draining(int event, Event *data)
// This should be the only difference between this and closing_state.
this->_close_packet_write_ready(data);
break;
- case QUIC_EVENT_DRAINING_TIMEOUT:
- this->_close_draining_timeout(data);
+ case QUIC_EVENT_CLOSING_TIMEOUT:
+ this->_close_closing_timeout(data);
can_switch_to_close_state = true;
break;
default:
QUICConDebug("Unexpected event: %s", QUICDebugNames::quic_event(event));
}
- // FIXME Enter closed state if CONNECTION_CLOSE was ACKed and draining period end
if (can_switch_to_close_state) {
this->_switch_to_close_state();
}
@@ -552,7 +556,7 @@ QUICNetVConnection::state_connection_closed(int event, Event *data)
switch (event) {
case QUIC_EVENT_SHUTDOWN: {
this->_unschedule_packet_write_ready();
- this->_unschedule_draining_timeout();
+ this->_unschedule_closing_timeout();
this->next_inactivity_timeout_at = 0;
this->next_activity_timeout_at = 0;
@@ -1060,28 +1064,28 @@ QUICNetVConnection::_close_packet_write_ready(Event *data)
}
void
-QUICNetVConnection::_schedule_draining_timeout(ink_hrtime interval)
+QUICNetVConnection::_schedule_closing_timeout(ink_hrtime interval)
{
- if (!this->_draining_timeout) {
- QUICConDebug("Schedule %s event", QUICDebugNames::quic_event(QUIC_EVENT_DRAINING_TIMEOUT));
- this->_draining_timeout = this_ethread()->schedule_in_local(this, interval, QUIC_EVENT_DRAINING_TIMEOUT);
+ if (!this->_closing_timeout) {
+ QUICConDebug("Schedule %s event", QUICDebugNames::quic_event(QUIC_EVENT_CLOSING_TIMEOUT));
+ this->_closing_timeout = this_ethread()->schedule_in_local(this, interval, QUIC_EVENT_CLOSING_TIMEOUT);
}
}
void
-QUICNetVConnection::_unschedule_draining_timeout()
+QUICNetVConnection::_unschedule_closing_timeout()
{
- if (this->_draining_timeout) {
- this->_draining_timeout->cancel();
- this->_draining_timeout = nullptr;
+ if (this->_closing_timeout) {
+ this->_closing_timeout->cancel();
+ this->_closing_timeout = nullptr;
}
}
void
-QUICNetVConnection::_close_draining_timeout(Event *data)
+QUICNetVConnection::_close_closing_timeout(Event *data)
{
- ink_assert(this->_draining_timeout == data);
- this->_draining_timeout = nullptr;
+ ink_assert(this->_closing_timeout == data);
+ this->_closing_timeout = nullptr;
}
int
@@ -1178,7 +1182,7 @@ QUICNetVConnection::_switch_to_draining_state(QUICConnectionErrorUPtr error)
// TODO The draining period should be obtained from QUICLossDetector since it is the only component that knows the RTO interval.
// Use 3 times kkMinRTOTimeout(200ms) for now.
- this->_schedule_draining_timeout(HRTIME_MSECONDS(3 * 200));
+ this->_schedule_closing_timeout(HRTIME_MSECONDS(3 * 200));
}
void
diff --git a/iocore/net/quic/QUICDebugNames.cc b/iocore/net/quic/QUICDebugNames.cc
index b85769c..a35f476 100644
--- a/iocore/net/quic/QUICDebugNames.cc
+++ b/iocore/net/quic/QUICDebugNames.cc
@@ -148,8 +148,8 @@ QUICDebugNames::quic_event(int event)
return "QUIC_EVENT_PACKET_READ_READY";
case QUIC_EVENT_PACKET_WRITE_READY:
return "QUIC_EVENT_PACKET_WRITE_READY";
- case QUIC_EVENT_DRAINING_TIMEOUT:
- return "QUIC_EVENT_DRAINING_TIMEOUT";
+ case QUIC_EVENT_CLOSING_TIMEOUT:
+ return "QUIC_EVENT_CLOSING_TIMEOUT";
case QUIC_EVENT_SHUTDOWN:
return "QUIC_EVENT_SHUTDOWN";
case QUIC_EVENT_LD_SHUTDOWN:
diff --git a/iocore/net/quic/QUICEvents.h b/iocore/net/quic/QUICEvents.h
index 71b2bc9..c3f9b44 100644
--- a/iocore/net/quic/QUICEvents.h
+++ b/iocore/net/quic/QUICEvents.h
@@ -29,7 +29,7 @@
enum {
QUIC_EVENT_PACKET_READ_READY = QUIC_EVENT_EVENTS_START,
QUIC_EVENT_PACKET_WRITE_READY,
- QUIC_EVENT_DRAINING_TIMEOUT,
+ QUIC_EVENT_CLOSING_TIMEOUT,
QUIC_EVENT_SHUTDOWN,
QUIC_EVENT_LD_SHUTDOWN,
};
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].