trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mas...@apache.org
Subject [trafficserver] 01/02: Don't return QUICError from FlowController
Date Mon, 04 Dec 2017 06:34:06 GMT
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 <maskit@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" <commits@trafficserver.apache.org>.

Mime
View raw message