You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/11/04 23:15:23 UTC
[trafficserver] branch 7.1.x updated: Send data fairly on H2
streams even if stream priority is disabled
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push:
new bdae4e4 Send data fairly on H2 streams even if stream priority is disabled
bdae4e4 is described below
commit bdae4e421f04e4083d04e5e7ba33cc9de175ad3c
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Tue Oct 31 15:52:52 2017 +0900
Send data fairly on H2 streams even if stream priority is disabled
(cherry picked from commit 6dcc822baf23b1ab69c9a2609fc4f65fd9f6c10b)
---
proxy/http2/Http2ConnectionState.cc | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index 225a1c0..2e684c4 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1042,16 +1042,36 @@ Http2ConnectionState::find_stream(Http2StreamId id) const
void
Http2ConnectionState::restart_streams()
{
- Http2Stream *s = stream_list.head;
-
- while (s) {
- Http2Stream *next = static_cast<Http2Stream *>(s->link.next);
+ // This is a static variable, so it is shared in Http2ConnectionState instances and will get incremented in subsequent calls.
+ // It doesn't need to be initialized with rand() nor time(), and doesn't need to be accessed with a lock, because it doesn't need
+ // that randomness and accuracy.
+ static uint16_t starting_point = 0;
+
+ Http2Stream *s = stream_list.head;
+ Http2Stream *end = s;
+ if (s) {
+ // Change the start point randomly
+ for (int i = starting_point % total_client_streams_count; i >= 0; --i) {
+ end = static_cast<Http2Stream *>(end->link.next ? end->link.next : stream_list.head);
+ }
+ s = static_cast<Http2Stream *>(end->link.next ? end->link.next : stream_list.head);
+
+ // Call send_response_body() for each streams
+ while (s != end) {
+ Http2Stream *next = static_cast<Http2Stream *>(s->link.next ? s->link.next : stream_list.head);
+ if (!s->is_closed() && s->get_state() == Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE &&
+ std::min(this->client_rwnd, s->client_rwnd) > 0) {
+ s->send_response_body();
+ }
+ ink_assert(s != next);
+ s = next;
+ }
if (!s->is_closed() && s->get_state() == Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE &&
min(this->client_rwnd, s->client_rwnd) > 0) {
s->send_response_body();
}
- ink_assert(s != next);
- s = next;
+
+ ++starting_point;
}
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].