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/16 05:33:55 UTC

[trafficserver] branch quic-latest updated: Respond with a closing frame on closing state

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 aa72487  Respond with a closing frame on closing state
aa72487 is described below

commit aa724876b275ade448747980ae8291dc07d13baa
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Jan 16 14:33:20 2018 +0900

    Respond with a closing frame on closing state
---
 iocore/net/P_QUICNetVConnection.h |  2 ++
 iocore/net/QUICNetVConnection.cc  | 29 +++++++++++++++++++++++++----
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h
index d076fd3..e63f34a 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -279,6 +279,7 @@ private:
   QUICErrorUPtr _state_connection_established_process_packet(QUICPacketUPtr packet);
   QUICErrorUPtr _state_common_receive_packet();
   QUICErrorUPtr _state_common_send_packet();
+  QUICErrorUPtr _state_closing_send_packet();
 
   Ptr<ProxyMutex> _packet_transmitter_mutex;
   Ptr<ProxyMutex> _frame_transmitter_mutex;
@@ -298,6 +299,7 @@ private:
   void _handle_idle_timeout();
   void _update_alt_connection_ids(uint8_t chosen);
 
+  QUICPacketUPtr _the_final_packet = QUICPacketFactory::create_null_packet();
   QUICStatelessResetToken _reset_token;
 };
 
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 45d4163..87e9c0e 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -492,10 +492,7 @@ QUICNetVConnection::state_connection_closing(int event, Event *data)
     break;
   case QUIC_EVENT_PACKET_WRITE_READY:
     this->_close_packet_write_ready(data);
-    // FIXME During the closing period, an endpoint that sends a
-    // closing frame SHOULD respond to any packet that it receives with
-    // another packet containing a closing frame.
-    this->_state_common_send_packet();
+    this->_state_closing_send_packet();
     break;
   case QUIC_EVENT_CLOSING_TIMEOUT:
     this->_close_closing_timeout(data);
@@ -769,6 +766,18 @@ QUICNetVConnection::_state_common_send_packet()
   return QUICErrorUPtr(new QUICNoError());
 }
 
+QUICErrorUPtr
+QUICNetVConnection::_state_closing_send_packet()
+{
+  // During the closing period, an endpoint that sends a
+  // closing frame SHOULD respond to any packet that it receives with
+  // another packet containing a closing frame.  To minimize the state
+  // that an endpoint maintains for a closing connection, endpoints MAY
+  // send the exact same packet.
+  this->_packet_handler->send_packet(*this->_the_final_packet, this);
+  return QUICErrorUPtr(new QUICNoError());
+}
+
 // Store frame data to buffer for packet. When remaining buffer is too small to store frame data or packet type is different from
 // previous one, build packet and transmit it. After that, allocate new buffer.
 void
@@ -802,6 +811,15 @@ QUICNetVConnection::_store_frame(ats_unique_buf &buf, size_t &len, bool &retrans
   frame->store(buf.get() + len, &l);
   len += l;
 
+  if (frame->type() == QUICFrameType::CONNECTION_CLOSE || frame->type() == QUICFrameType::APPLICATION_CLOSE) {
+    this->_transmit_packet(this->_build_packet(std::move(buf), len, retransmittable, previous_packet_type));
+    retransmittable = false;
+    len             = 0;
+    buf             = ats_unique_malloc(max_size);
+    frame->store(buf.get(), &l);
+    this->_the_final_packet = this->_build_packet(std::move(buf), l, false);
+  }
+
   return;
 }
 
@@ -836,6 +854,9 @@ QUICNetVConnection::_packetize_frames()
     frame = std::move(this->_frame_send_queue.front());
     this->_frame_send_queue.pop();
     this->_store_frame(buf, len, retransmittable, current_packet_type, std::move(frame));
+    if (this->_the_final_packet) {
+      return;
+    }
   }
 
   while (this->_stream_frame_send_queue.size() > 0) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].