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 9e07120  Respond to a STOP_SENDING with a RST_STREAM
9e07120 is described below

commit 9e0712024c3b5611007f084f8b5e2ef58be6be02
Author: Masakazu Kitajo <mas...@apache.org>
AuthorDate: Tue Apr 10 11:11:04 2018 +0900

    Respond to a STOP_SENDING with a RST_STREAM
---
 iocore/net/quic/QUICStream.cc        |  9 +++++++++
 iocore/net/quic/QUICStream.h         |  1 +
 iocore/net/quic/QUICStreamManager.cc | 17 ++++++++++++++++-
 iocore/net/quic/QUICStreamManager.h  |  1 +
 4 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index b0f1c5f..dff5737 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -357,6 +357,15 @@ QUICStream::recv(const std::shared_ptr<const 
QUICStreamBlockedFrame> frame)
   return QUICErrorUPtr(new QUICNoError());
 }
 
+QUICErrorUPtr
+QUICStream::recv(const std::shared_ptr<const QUICStopSendingFrame> frame)
+{
+  this->_state.update_with_received_frame(*frame);
+  this->_reset_reason = QUICStreamErrorUPtr(new QUICStreamError(this, 
QUIC_APP_ERROR_CODE_STOPPING));
+  // We received and processed STOP_SENDING frame, so return NO_ERROR here
+  return QUICErrorUPtr(new QUICNoError());
+}
+
 bool
 QUICStream::will_generate_frame()
 {
diff --git a/iocore/net/quic/QUICStream.h b/iocore/net/quic/QUICStream.h
index f2299f8..a5d7639 100644
--- a/iocore/net/quic/QUICStream.h
+++ b/iocore/net/quic/QUICStream.h
@@ -75,6 +75,7 @@ public:
   QUICErrorUPtr recv(const std::shared_ptr<const QUICStreamFrame> frame);
   QUICErrorUPtr recv(const std::shared_ptr<const QUICMaxStreamDataFrame> 
frame);
   QUICErrorUPtr recv(const std::shared_ptr<const QUICStreamBlockedFrame> 
frame);
+  QUICErrorUPtr recv(const std::shared_ptr<const QUICStopSendingFrame> frame);
 
   void reset(QUICStreamErrorUPtr error);
   void shutdown();
diff --git a/iocore/net/quic/QUICStreamManager.cc 
b/iocore/net/quic/QUICStreamManager.cc
index 3ff654d..9cefeb7 100644
--- a/iocore/net/quic/QUICStreamManager.cc
+++ b/iocore/net/quic/QUICStreamManager.cc
@@ -40,7 +40,8 @@ std::vector<QUICFrameType>
 QUICStreamManager::interests()
 {
   return {
-    QUICFrameType::STREAM, QUICFrameType::RST_STREAM, 
QUICFrameType::MAX_STREAM_DATA, QUICFrameType::MAX_STREAM_ID,
+    QUICFrameType::STREAM,          QUICFrameType::RST_STREAM,    
QUICFrameType::STOP_SENDING,
+    QUICFrameType::MAX_STREAM_DATA, QUICFrameType::MAX_STREAM_ID,
   };
 }
 
@@ -124,6 +125,9 @@ QUICStreamManager::handle_frame(std::shared_ptr<const 
QUICFrame> frame)
   case QUICFrameType::STREAM:
     error = this->_handle_frame(std::static_pointer_cast<const 
QUICStreamFrame>(frame));
     break;
+  case QUICFrameType::STOP_SENDING:
+    error = this->_handle_frame(std::static_pointer_cast<const 
QUICStopSendingFrame>(frame));
+    break;
   case QUICFrameType::RST_STREAM:
     error = this->_handle_frame(std::static_pointer_cast<const 
QUICRstStreamFrame>(frame));
     break;
@@ -192,6 +196,17 @@ QUICStreamManager::_handle_frame(const 
std::shared_ptr<const QUICRstStreamFrame>
 }
 
 QUICErrorUPtr
+QUICStreamManager::_handle_frame(const std::shared_ptr<const 
QUICStopSendingFrame> &frame)
+{
+  QUICStream *stream = this->_find_or_create_stream(frame->stream_id());
+  if (stream) {
+    return stream->recv(frame);
+  } else {
+    return QUICErrorUPtr(new 
QUICConnectionError(QUICTransErrorCode::STREAM_ID_ERROR));
+  }
+}
+
+QUICErrorUPtr
 QUICStreamManager::_handle_frame(const std::shared_ptr<const 
QUICMaxStreamIdFrame> &frame)
 {
   QUICStreamType type = 
QUICTypeUtil::detect_stream_type(frame->maximum_stream_id());
diff --git a/iocore/net/quic/QUICStreamManager.h 
b/iocore/net/quic/QUICStreamManager.h
index f453ab6..a58af82 100644
--- a/iocore/net/quic/QUICStreamManager.h
+++ b/iocore/net/quic/QUICStreamManager.h
@@ -68,6 +68,7 @@ private:
   QUICStream *_find_or_create_stream(QUICStreamId stream_id);
   QUICErrorUPtr _handle_frame(const std::shared_ptr<const QUICStreamFrame> &);
   QUICErrorUPtr _handle_frame(const std::shared_ptr<const QUICRstStreamFrame> 
&);
+  QUICErrorUPtr _handle_frame(const std::shared_ptr<const 
QUICStopSendingFrame> &);
   QUICErrorUPtr _handle_frame(const std::shared_ptr<const 
QUICMaxStreamDataFrame> &);
   QUICErrorUPtr _handle_frame(const std::shared_ptr<const 
QUICStreamBlockedFrame> &);
   QUICErrorUPtr _handle_frame(const std::shared_ptr<const 
QUICMaxStreamIdFrame> &);

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

Reply via email to