Skip to content

Commit

Permalink
Merge pull request grpc#22615 from yashykt/http2maxwindowsize
Browse files Browse the repository at this point in the history
Clamp the receive flow control window size to ((1 << 31) - 1)
  • Loading branch information
yashykt committed Apr 9, 2020
2 parents 9e82d59 + 652ab6c commit 3dca4a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/ext/transport/chttp2/transport/flow_control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ void StreamFlowControl::IncomingByteStreamUpdate(size_t max_size_hint,
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE];

/* clamp max recv hint to an allowable size */
if (max_size_hint >= UINT32_MAX - sent_init_window) {
max_recv_bytes = UINT32_MAX - sent_init_window;
if (max_size_hint >= kMaxWindowUpdateSize - sent_init_window) {
max_recv_bytes = kMaxWindowUpdateSize - sent_init_window;
} else {
max_recv_bytes = static_cast<uint32_t>(max_size_hint);
}
Expand All @@ -298,7 +298,7 @@ void StreamFlowControl::IncomingByteStreamUpdate(size_t max_size_hint,
}

/* add some small lookahead to keep pipelines flowing */
GPR_ASSERT(max_recv_bytes <= UINT32_MAX - sent_init_window);
GPR_DEBUG_ASSERT(max_recv_bytes <= kMaxWindowUpdateSize - sent_init_window);
if (local_window_delta_ < max_recv_bytes) {
uint32_t add_max_recv_bytes =
static_cast<uint32_t>(max_recv_bytes - local_window_delta_);
Expand Down

0 comments on commit 3dca4a3

Please sign in to comment.