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/12/04 06:34:05 UTC

[trafficserver] branch quic-latest updated (3f0a35b -> 16eca82)

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

maskit pushed a change to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


    from 3f0a35b  Fix big file transfer
     new b9c256c  Don't return QUICError from FlowController
     new 16eca82  Fix a bug that QUICStream can consume window without sending frames

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/QUICNetVConnection.cc      | 18 +++++++++---------
 iocore/net/quic/QUICFlowController.cc | 14 +++++++-------
 iocore/net/quic/QUICFlowController.h  |  8 ++++++--
 iocore/net/quic/QUICStream.cc         | 28 +++++++++++++++-------------
 4 files changed, 37 insertions(+), 31 deletions(-)

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

[trafficserver] 01/02: Don't return QUICError from FlowController

Posted by ma...@apache.org.
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

commit b9c256cda794194ec6d25cc55f7983b52f4335f9
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Mon Dec 4 15:28:09 2017 +0900

    Don't return QUICError from FlowController
---
 iocore/net/QUICNetVConnection.cc      | 18 +++++++++---------
 iocore/net/quic/QUICFlowController.cc | 14 +++++++-------
 iocore/net/quic/QUICFlowController.h  |  8 ++++++--
 iocore/net/quic/QUICStream.cc         | 13 +++++++------
 4 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 3c8f028..00d3447 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -629,12 +629,12 @@ QUICNetVConnection::_state_handshake_process_initial_client_packet(QUICPacketUPt
     if (error->cls != QUICErrorClass::NONE) {
       return error;
     }
-    error = this->_local_flow_controller->update(this->_stream_manager->total_offset_received());
+    int ret = this->_local_flow_controller->update(this->_stream_manager->total_offset_received());
     Debug("quic_flow_ctrl", "Connection [%" PRIx64 "] [LOCAL] %" PRIu64 "/%" PRIu64,
           static_cast<uint64_t>(this->_quic_connection_id), this->_local_flow_controller->current_offset(),
           this->_local_flow_controller->current_limit());
-    if (error->cls != QUICErrorClass::NONE) {
-      return error;
+    if (ret != 0) {
+      return QUICErrorUPtr(new QUICConnectionError(QUICTransErrorCode::FLOW_CONTROL_ERROR));
     }
   } else {
     // Perhaps response packets for initial client packet were lost, but no need to start handshake again because loss detector will
@@ -769,13 +769,13 @@ QUICNetVConnection::_packetize_frames()
     const QUICFrameUPtr &f = this->_stream_frame_send_queue.front();
     uint32_t frame_size    = f->size();
 
-    QUICErrorUPtr error = this->_remote_flow_controller->update((this->_stream_manager->total_offset_sent() + frame_size));
+    int ret = this->_remote_flow_controller->update((this->_stream_manager->total_offset_sent() + frame_size));
     Debug("quic_flow_ctrl", "Connection [%" PRIx64 "] [REMOTE] %" PRIu64 "/%" PRIu64,
           static_cast<uint64_t>(this->_quic_connection_id), this->_remote_flow_controller->current_offset(),
           this->_remote_flow_controller->current_limit());
 
-    if (error->cls != QUICErrorClass::NONE) {
-      // Flow Contoroller blocked sending STREAM frame
+    if (ret != 0) {
+      DebugQUICCon("Flow Controller blocked sending a STREAM frame");
       break;
     }
 
@@ -813,11 +813,11 @@ QUICNetVConnection::_recv_and_ack(const uint8_t *payload, uint16_t size, QUICPac
     return error;
   }
 
-  error = this->_local_flow_controller->update(this->_stream_manager->total_offset_received());
+  int ret = this->_local_flow_controller->update(this->_stream_manager->total_offset_received());
   Debug("quic_flow_ctrl", "Connection [%" PRIx64 "] [LOCAL] %" PRIu64 "/%" PRIu64, static_cast<uint64_t>(this->_quic_connection_id),
         this->_local_flow_controller->current_offset(), this->_local_flow_controller->current_limit());
-  if (error->cls != QUICErrorClass::NONE) {
-    return error;
+  if (ret != 0) {
+    return QUICErrorUPtr(new QUICConnectionError(QUICTransErrorCode::FLOW_CONTROL_ERROR));
   }
   // this->_local_flow_controller->forward_limit();
 
diff --git a/iocore/net/quic/QUICFlowController.cc b/iocore/net/quic/QUICFlowController.cc
index 68e01c5..7c8f080 100644
--- a/iocore/net/quic/QUICFlowController.cc
+++ b/iocore/net/quic/QUICFlowController.cc
@@ -40,18 +40,18 @@ QUICFlowController::current_limit()
   return this->_limit;
 }
 
-QUICErrorUPtr
+int
 QUICFlowController::update(QUICOffset offset)
 {
   if (this->_offset <= offset) {
     // Assume flow control is not initialized if the limit was 0
     if (this->_limit != 0 && offset > this->_limit) {
-      return QUICErrorUPtr(new QUICConnectionError(QUICTransErrorCode::FLOW_CONTROL_ERROR));
+      return -1;
     }
     this->_offset = offset;
   }
 
-  return QUICErrorUPtr(new QUICNoError());
+  return 0;
 }
 
 void
@@ -81,14 +81,14 @@ QUICRemoteFlowController::forward_limit(QUICOffset offset)
   this->_blocked = false;
 }
 
-QUICErrorUPtr
+int
 QUICRemoteFlowController::update(QUICOffset offset)
 {
-  QUICErrorUPtr error = QUICFlowController::update(offset);
+  int ret = QUICFlowController::update(offset);
 
   // Assume flow control is not initialized if the limit was 0
   if (this->_limit == 0) {
-    return error;
+    return ret;
   }
 
   // Send BLOCKED(_STREAM) frame
@@ -97,7 +97,7 @@ QUICRemoteFlowController::update(QUICOffset offset)
     this->_blocked = true;
   }
 
-  return error;
+  return ret;
 }
 
 //
diff --git a/iocore/net/quic/QUICFlowController.h b/iocore/net/quic/QUICFlowController.h
index d195728..6a56aa3 100644
--- a/iocore/net/quic/QUICFlowController.h
+++ b/iocore/net/quic/QUICFlowController.h
@@ -33,7 +33,11 @@ class QUICFlowController
 public:
   QUICOffset current_offset();
   QUICOffset current_limit();
-  virtual QUICErrorUPtr update(QUICOffset offset);
+
+  /*
+   * Returns 0 if succeed
+   */
+  virtual int update(QUICOffset offset);
   virtual void forward_limit(QUICOffset limit);
   void set_threshold(uint64_t threshold);
 
@@ -51,7 +55,7 @@ class QUICRemoteFlowController : public QUICFlowController
 {
 public:
   QUICRemoteFlowController(uint64_t initial_limit, QUICFrameTransmitter *tx) : QUICFlowController(initial_limit, tx) {}
-  QUICErrorUPtr update(QUICOffset offset) override;
+  int update(QUICOffset offset) override;
   void forward_limit(QUICOffset limit) override;
 
 private:
diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index 1017a9f..429c804 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -305,14 +305,14 @@ QUICStream::recv(const std::shared_ptr<const QUICStreamFrame> frame)
   }
 
   // Flow Control - Even if it's allowed to receive on the state, it may exceed the limit
-  QUICErrorUPtr error = this->_local_flow_controller->update(frame->offset() + frame->data_length());
+  int ret = this->_local_flow_controller->update(frame->offset() + frame->data_length());
   DebugQUICStreamFC("[LOCAL] %" PRIu64 "/%" PRIu64, this->_local_flow_controller->current_offset(),
                     this->_local_flow_controller->current_limit());
-  if (error->cls != QUICErrorClass::NONE) {
-    return error;
+  if (ret != 0) {
+    return QUICErrorUPtr(new QUICConnectionError(QUICTransErrorCode::FLOW_CONTROL_ERROR));
   }
 
-  error = this->_received_stream_frame_buffer.insert(frame);
+  QUICErrorUPtr error = this->_received_stream_frame_buffer.insert(frame);
   if (error->cls != QUICErrorClass::NONE) {
     this->_received_stream_frame_buffer.clear();
     return error;
@@ -379,10 +379,11 @@ QUICStream::_send()
       }
     }
 
-    error = this->_remote_flow_controller->update(this->_send_offset + len);
+    int ret = this->_remote_flow_controller->update(this->_send_offset + len);
     DebugQUICStreamFC("[REMOTE] %" PRIu64 "/%" PRIu64, this->_remote_flow_controller->current_offset(),
                       this->_remote_flow_controller->current_limit());
-    if (error->cls != QUICErrorClass::NONE) {
+    if (ret != 0) {
+      DebugQUICStream("Flow Controller blocked sending a STREAM frame");
       break;
     }
 

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

[trafficserver] 02/02: Fix a bug that QUICStream can consume window without sending frames

Posted by ma...@apache.org.
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

commit 16eca8226501a1292d934d35e8cf3e618eebd910
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Mon Dec 4 15:33:11 2017 +0900

    Fix a bug that QUICStream can consume window without sending frames
---
 iocore/net/quic/QUICStream.cc | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/iocore/net/quic/QUICStream.cc b/iocore/net/quic/QUICStream.cc
index 429c804..1f6a6c4 100644
--- a/iocore/net/quic/QUICStream.cc
+++ b/iocore/net/quic/QUICStream.cc
@@ -379,6 +379,13 @@ QUICStream::_send()
       }
     }
 
+    QUICStreamFrameUPtr frame = QUICFrameFactory::create_stream_frame(reinterpret_cast<const uint8_t *>(reader->start()), len,
+                                                                      this->_id, this->_send_offset, fin);
+    if (!this->_state.is_allowed_to_send(*frame)) {
+      DebugQUICStream("Canceled sending %s frame due to the stream state", QUICDebugNames::frame_type(frame->type()));
+      break;
+    }
+
     int ret = this->_remote_flow_controller->update(this->_send_offset + len);
     DebugQUICStreamFC("[REMOTE] %" PRIu64 "/%" PRIu64, this->_remote_flow_controller->current_offset(),
                       this->_remote_flow_controller->current_limit());
@@ -386,19 +393,13 @@ QUICStream::_send()
       DebugQUICStream("Flow Controller blocked sending a STREAM frame");
       break;
     }
-
-    QUICStreamFrameUPtr frame = QUICFrameFactory::create_stream_frame(reinterpret_cast<const uint8_t *>(reader->start()), len,
-                                                                      this->_id, this->_send_offset, fin);
+    // We cannot cancel sending the frame after updating the flow controller
 
     this->_send_offset += len;
     reader->consume(len);
     this->_write_vio.ndone += len;
     total_len += len;
 
-    if (!this->_state.is_allowed_to_send(*frame)) {
-      DebugQUICStream("Canceled sending %s frame due to the stream state", QUICDebugNames::frame_type(frame->type()));
-      break;
-    }
     this->_state.update_with_sent_frame(*frame);
     this->_tx->transmit_frame(std::move(frame));
   }

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