diff options
author | Craig Tiller <ctiller@google.com> | 2017-01-27 15:32:31 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-01-27 15:32:31 -0800 |
commit | 75bcb608c51c438303407b703105a8fa2cafb8a2 (patch) | |
tree | c788157659d92c5eddaa831ece7791e7d4641944 | |
parent | adc003a4809ac5f3fe9c83291167320a43935c81 (diff) |
Fix bugs with TCP
-rw-r--r-- | src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 | ||||
-rw-r--r-- | src/core/ext/transport/chttp2/transport/parsing.c | 5 | ||||
-rw-r--r-- | src/core/ext/transport/chttp2/transport/writing.c | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 26c4a5fe13..c1d2bb2227 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2022,7 +2022,7 @@ static void incoming_byte_stream_update_flow_control(grpc_exec_ctx *exec_ctx, (uint32_t)(max_recv_bytes - s->incoming_window_delta); bool new_window_write_is_covered_by_poller = s->incoming_window_delta + initial_window_size < (int64_t)have_already; - bool force_send = (s->incoming_window_delta - s->announce_window < + bool force_send = (s->incoming_window_delta - s->announce_window <= -(int64_t)initial_window_size / 2); /* gpr_log(GPR_DEBUG, "%d %d %d", (int)(s->incoming_window_delta - s->announce_window), diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 71161f77a0..7e8ca55e83 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -381,7 +381,7 @@ static grpc_error *update_incoming_window(grpc_exec_ctx *exec_ctx, 1024); GRPC_CHTTP2_FLOW_DEBIT_TRANSPORT("parse", t, incoming_window, incoming_frame_size); - if (t->incoming_window < target_incoming_window / 2) { + if (t->incoming_window <= target_incoming_window / 2) { grpc_chttp2_initiate_write(exec_ctx, t, false, "flow_control"); } @@ -403,7 +403,8 @@ static grpc_error *update_incoming_window(grpc_exec_ctx *exec_ctx, if (s != NULL) { GRPC_CHTTP2_FLOW_DEBIT_STREAM("parse", t, s, incoming_window_delta, incoming_frame_size); - if (s->incoming_window_delta < -target_incoming_window / 2) { + if (s->incoming_window_delta - s->announce_window <= + -(int64_t)target_incoming_window / 2) { grpc_chttp2_become_writable(exec_ctx, t, s, false, "window-update-required"); } diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index 1ff467b33d..3cb4841336 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -316,7 +316,7 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, uint32_t threshold_to_send_transport_window_update = t->outbuf.count > 0 ? 3 * target_incoming_window / 4 : target_incoming_window / 2; - if (t->incoming_window < threshold_to_send_transport_window_update) { + if (t->incoming_window <= threshold_to_send_transport_window_update) { maybe_initiate_ping(exec_ctx, t, GRPC_CHTTP2_PING_BEFORE_TRANSPORT_WINDOW_UPDATE); uint32_t announced = (uint32_t)GPR_CLAMP( |