This is an automated email from the ASF dual-hosted git repository.

scw00 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 532e9dd  QUIC: Send close frame packet when we are in close period
532e9dd is described below

commit 532e9dd14d1c3c44b58d4853afaed2d2dd1af045
Author: scw00 <sc...@apache.org>
AuthorDate: Fri Feb 23 10:22:47 2018 +0800

    QUIC: Send close frame packet when we are in close period
---
 iocore/net/P_QUICNetVConnection.h |  1 +
 iocore/net/QUICNetVConnection.cc  | 22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index 06d7139..59677de 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -288,6 +288,7 @@ private:
   QUICErrorUPtr 
_state_handshake_process_zero_rtt_protected_packet(QUICPacketUPtr packet);
   QUICErrorUPtr _state_connection_established_process_packet(QUICPacketUPtr 
packet);
   QUICErrorUPtr _state_common_receive_packet();
+  QUICErrorUPtr _state_connection_closing_and_draining_receive_packet();
   QUICErrorUPtr _state_common_send_packet();
   QUICErrorUPtr _state_closing_send_packet();
 
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index e181afc..708a3e0 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -602,7 +602,7 @@ QUICNetVConnection::state_connection_closing(int event, 
Event *data)
   QUICErrorUPtr error = QUICErrorUPtr(new QUICNoError());
   switch (event) {
   case QUIC_EVENT_PACKET_READ_READY:
-    error = this->_state_common_receive_packet();
+    error = this->_state_connection_closing_and_draining_receive_packet();
     break;
   case QUIC_EVENT_PACKET_WRITE_READY:
     this->_close_packet_write_ready(data);
@@ -628,7 +628,7 @@ QUICNetVConnection::state_connection_draining(int event, 
Event *data)
   QUICErrorUPtr error = QUICErrorUPtr(new QUICNoError());
   switch (event) {
   case QUIC_EVENT_PACKET_READ_READY:
-    error = this->_state_common_receive_packet();
+    error = this->_state_connection_closing_and_draining_receive_packet();
     break;
   case QUIC_EVENT_PACKET_WRITE_READY:
     // Do not send any packets in this state.
@@ -877,6 +877,24 @@ QUICNetVConnection::_state_common_receive_packet()
 }
 
 QUICErrorUPtr
+QUICNetVConnection::_state_connection_closing_and_draining_receive_packet()
+{
+  QUICPacketCreationResult result;
+  QUICPacketUPtr packet = this->_dequeue_recv_packet(result);
+  if (result == QUICPacketCreationResult::SUCCESS) {
+    this->_recv_and_ack(packet->payload(), packet->payload_size(), 
packet->packet_number());
+    this->_schedule_packet_write_ready();
+  }
+
+  if (this->_packet_recv_queue.size > 0) {
+    // FIXME: scheduling new event to ensure the closed frame could be sent.
+    this_ethread()->schedule_in_local(this, HRTIME_MSECONDS(10), 
QUIC_EVENT_PACKET_READ_READY);
+  }
+
+  return QUICErrorUPtr(new QUICNoError());
+}
+
+QUICErrorUPtr
 QUICNetVConnection::_state_common_send_packet()
 {
   this->_packetize_frames();

-- 
To stop receiving notification emails like this one, please contact
sc...@apache.org.

Reply via email to