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 2017/10/18 01:56:22 UTC

[trafficserver] branch quic-latest updated: Fix max stream id limitation

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 5e71363  Fix max stream id limitation
5e71363 is described below

commit 5e713636eca3c1ef870a043b71b3935ff10d579b
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Wed Oct 18 10:55:41 2017 +0900

    Fix max stream id limitation
---
 iocore/net/quic/QUICStreamManager.cc |  7 +++++--
 iocore/net/quic/QUICTypes.cc         | 11 +++++++++++
 iocore/net/quic/QUICTypes.h          |  3 +++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/iocore/net/quic/QUICStreamManager.cc b/iocore/net/quic/QUICStreamManager.cc
index 47b4bbe..e7fc1c0 100644
--- a/iocore/net/quic/QUICStreamManager.cc
+++ b/iocore/net/quic/QUICStreamManager.cc
@@ -197,8 +197,11 @@ QUICStreamManager::_find_or_create_stream(QUICStreamId stream_id)
 {
   QUICStream *stream = this->_find_stream(stream_id);
   if (!stream) {
-    if ((stream_id > this->_local_maximum_stream_id && this->_local_maximum_stream_id != 0) ||
-        (stream_id > this->_remote_maximum_stream_id && this->_remote_maximum_stream_id != 0)) {
+    QUICStreamType type = QUICTypeUtil::detect_stream_type(stream_id);
+    if (type == QUICStreamType::CLIENT && stream_id > this->_local_maximum_stream_id && this->_local_maximum_stream_id != 0) {
+      return nullptr;
+    } else if (type == QUICStreamType::CLIENT && stream_id > this->_remote_maximum_stream_id &&
+               this->_remote_maximum_stream_id != 0) {
       return nullptr;
     }
     // TODO Free the stream somewhere
diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc
index c4d327e..40c8a02 100644
--- a/iocore/net/quic/QUICTypes.cc
+++ b/iocore/net/quic/QUICTypes.cc
@@ -35,6 +35,17 @@ QUICTypeUtil::hasLongHeader(const uint8_t *buf)
   return (buf[0] & 0x80) != 0;
 }
 
+QUICStreamType
+QUICTypeUtil::detect_stream_type(QUICStreamId id)
+{
+  uint8_t type = (id & 0x01);
+  if (type == 0) {
+    return QUICStreamType::HANDSHAKE;
+  } else {
+    return static_cast<QUICStreamType>(type);
+  }
+}
+
 QUICConnectionId
 QUICTypeUtil::read_QUICConnectionId(const uint8_t *buf, uint8_t len)
 {
diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h
index d25f36a..2f29bd2 100644
--- a/iocore/net/quic/QUICTypes.h
+++ b/iocore/net/quic/QUICTypes.h
@@ -236,6 +236,8 @@ private:
   uint64_t _id;
 };
 
+enum class QUICStreamType { CLIENT, SERVER, HANDSHAKE };
+
 class QUICMaximumData
 {
 public:
@@ -294,6 +296,7 @@ class QUICTypeUtil
 {
 public:
   static bool hasLongHeader(const uint8_t *buf);
+  static QUICStreamType detect_stream_type(QUICStreamId id);
 
   static QUICConnectionId read_QUICConnectionId(const uint8_t *buf, uint8_t n);
   static QUICPacketNumber read_QUICPacketNumber(const uint8_t *buf, uint8_t n);

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