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/05/31 07:09:26 UTC

[trafficserver] branch quic-latest updated: Print bidirectional stream state appropriately

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 f6d2922  Print bidirectional stream state appropriately
f6d2922 is described below

commit f6d2922fe074d14fff7eb57e249367974e8cd782
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Thu May 31 16:09:04 2018 +0900

    Print bidirectional stream state appropriately
---
 iocore/net/quic/QUICDebugNames.cc  |  8 ++++++++
 iocore/net/quic/QUICStreamState.cc | 41 ++++++++++++++++++++++++++++++++++++++
 iocore/net/quic/QUICStreamState.h  | 20 +++++++++++++++----
 3 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/iocore/net/quic/QUICDebugNames.cc b/iocore/net/quic/QUICDebugNames.cc
index d9a700c..df250d6 100644
--- a/iocore/net/quic/QUICDebugNames.cc
+++ b/iocore/net/quic/QUICDebugNames.cc
@@ -220,6 +220,14 @@ QUICDebugNames::stream_state(const QUICStreamState &state)
     return "DATA_READ";
   case QUICStreamState::State::ResetRead:
     return "RESET_READ";
+  case QUICStreamState::State::Open:
+    return "OPEN";
+  case QUICStreamState::State::HC_L:
+    return "HC_L";
+  case QUICStreamState::State::HC_R:
+    return "HC_R";
+  case QUICStreamState::State::Closed:
+    return "CLOSED";
   case QUICStreamState::State::_Invalid:
     return "INVALID";
   default:
diff --git a/iocore/net/quic/QUICStreamState.cc b/iocore/net/quic/QUICStreamState.cc
index 2c7337c..9d8e864 100644
--- a/iocore/net/quic/QUICStreamState.cc
+++ b/iocore/net/quic/QUICStreamState.cc
@@ -321,6 +321,47 @@ QUICSendStreamState::update(const QUICStreamState &opposite_side)
 
 // ---------QUICBidirectionalStreamState -----------
 
+QUICStreamState::State
+QUICBidirectionalStreamState::get() const
+{
+  QUICStreamState::State s_state = this->_send_stream_state.get();
+  QUICStreamState::State r_state = this->_recv_stream_state.get();
+
+  if (s_state == State::Ready || s_state == State::Send || s_state == State::DataSent) {
+    if (r_state == State::Recv || r_state == State::SizeKnown) {
+      return State::Open;
+    } else if (r_state == State::DataRecvd || r_state == State::DataRead) {
+      return State::HC_R;
+    } else if (r_state == State::ResetRecvd || r_state == State::ResetRead) {
+      return State::HC_R;
+    } else {
+      return State::_Invalid;
+    }
+  } else if (s_state == State::DataRecvd) {
+    if (r_state == State::Recv || r_state == State::SizeKnown) {
+      return State::HC_L;
+    } else if (r_state == State::DataRecvd || r_state == State::DataRead) {
+      return State::Closed;
+    } else if (r_state == State::ResetRecvd || r_state == State::ResetRead) {
+      return State::Closed;
+    } else {
+      return State::_Invalid;
+    }
+  } else if (s_state == State::ResetSent || s_state == State::ResetRecvd) {
+    if (r_state == State::Recv || r_state == State::SizeKnown) {
+      return State::HC_L;
+    } else if (r_state == State::DataRecvd || r_state == State::DataRead) {
+      return State::Closed;
+    } else if (r_state == State::ResetRecvd || r_state == State::ResetRead) {
+      return State::Closed;
+    } else {
+      return State::_Invalid;
+    }
+  } else {
+    return State::_Invalid;
+  }
+}
+
 void
 QUICBidirectionalStreamState::update_with_sending_frame(const QUICFrame &frame)
 {
diff --git a/iocore/net/quic/QUICStreamState.h b/iocore/net/quic/QUICStreamState.h
index 6cdc014..0cc11a5 100644
--- a/iocore/net/quic/QUICStreamState.h
+++ b/iocore/net/quic/QUICStreamState.h
@@ -29,23 +29,33 @@ class QUICStreamState
 {
 public:
   enum class State {
+    // Common
     _Init,
+    _Invalid,
+    // SendStreamState
     Ready,
     Send,
     DataSent,
     DataRecvd,
     ResetSent,
     ResetRecvd,
+    // ReceiveStreamState
     Recv,
     SizeKnown,
-    /* DataRecvd, */ DataRead,
-    /* ResetRecvd, */ ResetRead,
-    _Invalid
+    /* DataRecvd, */
+    DataRead,
+    /* ResetRecvd, */
+    ResetRead,
+    // Bidirectional
+    Open,
+    HC_R,
+    HC_L,
+    Closed
   };
 
   virtual ~QUICStreamState() {}
 
-  State
+  virtual State
   get() const
   {
     return this->_state;
@@ -95,6 +105,8 @@ public:
 class QUICBidirectionalStreamState : public QUICStreamState
 {
 public:
+  State get() const override;
+
   void update_with_sending_frame(const QUICFrame &frame) override;
   void update_with_receiving_frame(const QUICFrame &frame) override;
 

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