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/08/31 05:27:20 UTC
[trafficserver] 02/02: Update connection level FC (local) only if
received packet include STREAM frame
This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 01030555a4cfe8e421886673e8dfdc592e13c53a
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri Aug 31 14:24:26 2018 +0900
Update connection level FC (local) only if received packet include STREAM frame
---
iocore/net/QUICNetVConnection.cc | 23 +++++++++++++----------
iocore/net/quic/QUICFrameDispatcher.cc | 8 +++++++-
iocore/net/quic/QUICFrameDispatcher.h | 3 ++-
iocore/net/quic/test/test_QUICFrameDispatcher.cc | 5 +++--
4 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc
index 81a32a0..83a3cb0 100644
--- a/iocore/net/QUICNetVConnection.cc
+++ b/iocore/net/QUICNetVConnection.cc
@@ -1369,10 +1369,11 @@ QUICNetVConnection::_recv_and_ack(QUICPacketUPtr packet)
QUICEncryptionLevel level = QUICTypeUtil::encryption_level(packet->type());
bool should_send_ack;
+ bool is_flow_controlled;
QUICErrorUPtr error = QUICErrorUPtr(new QUICNoError());
- error = this->_frame_dispatcher->receive_frames(level, payload, size, should_send_ack);
+ error = this->_frame_dispatcher->receive_frames(level, payload, size, should_send_ack, is_flow_controlled);
if (error->cls != QUICErrorClass::NONE) {
return error;
}
@@ -1381,17 +1382,19 @@ QUICNetVConnection::_recv_and_ack(QUICPacketUPtr packet)
should_send_ack = false;
}
- int ret = this->_local_flow_controller->update(this->_stream_manager->total_offset_received());
- QUICFCDebug("[LOCAL] %" PRIu64 "/%" PRIu64, this->_local_flow_controller->current_offset(),
- this->_local_flow_controller->current_limit());
+ if (is_flow_controlled) {
+ int ret = this->_local_flow_controller->update(this->_stream_manager->total_offset_received());
+ QUICFCDebug("[LOCAL] %" PRIu64 "/%" PRIu64, this->_local_flow_controller->current_offset(),
+ this->_local_flow_controller->current_limit());
- if (ret != 0) {
- return QUICErrorUPtr(new QUICConnectionError(QUICTransErrorCode::FLOW_CONTROL_ERROR));
- }
+ if (ret != 0) {
+ return QUICErrorUPtr(new QUICConnectionError(QUICTransErrorCode::FLOW_CONTROL_ERROR));
+ }
- this->_local_flow_controller->forward_limit(this->_stream_manager->total_reordered_bytes() + this->_flow_control_buffer_size);
- QUICFCDebug("[LOCAL] %" PRIu64 "/%" PRIu64, this->_local_flow_controller->current_offset(),
- this->_local_flow_controller->current_limit());
+ this->_local_flow_controller->forward_limit(this->_stream_manager->total_reordered_bytes() + this->_flow_control_buffer_size);
+ QUICFCDebug("[LOCAL] %" PRIu64 "/%" PRIu64, this->_local_flow_controller->current_offset(),
+ this->_local_flow_controller->current_limit());
+ }
this->_ack_frame_creator.update(level, packet_num, should_send_ack);
diff --git a/iocore/net/quic/QUICFrameDispatcher.cc b/iocore/net/quic/QUICFrameDispatcher.cc
index 3d5c876..543a147 100644
--- a/iocore/net/quic/QUICFrameDispatcher.cc
+++ b/iocore/net/quic/QUICFrameDispatcher.cc
@@ -42,11 +42,13 @@ QUICFrameDispatcher::add_handler(QUICFrameHandler *handler)
}
QUICErrorUPtr
-QUICFrameDispatcher::receive_frames(QUICEncryptionLevel level, const uint8_t *payload, uint16_t size, bool &should_send_ack)
+QUICFrameDispatcher::receive_frames(QUICEncryptionLevel level, const uint8_t *payload, uint16_t size, bool &should_send_ack,
+ bool &is_flow_controlled)
{
std::shared_ptr<const QUICFrame> frame(nullptr);
uint16_t cursor = 0;
should_send_ack = false;
+ is_flow_controlled = false;
QUICErrorUPtr error = QUICErrorUPtr(new QUICNoError());
while (cursor < size) {
@@ -59,6 +61,10 @@ QUICFrameDispatcher::receive_frames(QUICEncryptionLevel level, const uint8_t *pa
QUICFrameType type = frame->type();
+ if (type == QUICFrameType::STREAM) {
+ is_flow_controlled = true;
+ }
+
if (is_debug_tag_set(tag) && type != QUICFrameType::PADDING) {
char msg[1024];
frame->debug_msg(msg, sizeof(msg));
diff --git a/iocore/net/quic/QUICFrameDispatcher.h b/iocore/net/quic/QUICFrameDispatcher.h
index 6db357d..bd65ba1 100644
--- a/iocore/net/quic/QUICFrameDispatcher.h
+++ b/iocore/net/quic/QUICFrameDispatcher.h
@@ -37,7 +37,8 @@ public:
/*
* Returns true if ACK frame should be sent
*/
- QUICErrorUPtr receive_frames(QUICEncryptionLevel level, const uint8_t *payload, uint16_t size, bool &should_send_ack);
+ QUICErrorUPtr receive_frames(QUICEncryptionLevel level, const uint8_t *payload, uint16_t size, bool &should_send_ackbool,
+ bool &is_flow_controlled);
void add_handler(QUICFrameHandler *handler);
diff --git a/iocore/net/quic/test/test_QUICFrameDispatcher.cc b/iocore/net/quic/test/test_QUICFrameDispatcher.cc
index 30b38ce..a90752d 100644
--- a/iocore/net/quic/test/test_QUICFrameDispatcher.cc
+++ b/iocore/net/quic/test/test_QUICFrameDispatcher.cc
@@ -57,14 +57,15 @@ TEST_CASE("QUICFrameHandler", "[quic]")
size_t len = 0;
streamFrame.store(buf, &len, 4096);
bool should_send_ack;
- quicFrameDispatcher.receive_frames(QUICEncryptionLevel::INITIAL, buf, len, should_send_ack);
+ bool is_flow_controlled;
+ quicFrameDispatcher.receive_frames(QUICEncryptionLevel::INITIAL, buf, len, should_send_ack, is_flow_controlled);
CHECK(connection->getTotalFrameCount() == 0);
CHECK(streamManager->getTotalFrameCount() == 1);
// CONNECTION_CLOSE frame
QUICConnectionCloseFrame connectionCloseFrame({});
connectionCloseFrame.store(buf, &len, 4096);
- quicFrameDispatcher.receive_frames(QUICEncryptionLevel::INITIAL, buf, len, should_send_ack);
+ quicFrameDispatcher.receive_frames(QUICEncryptionLevel::INITIAL, buf, len, should_send_ack, is_flow_controlled);
CHECK(connection->getTotalFrameCount() == 1);
CHECK(streamManager->getTotalFrameCount() == 1);
}