Fix an edge case in call.c

If we get a full incoming buffer, we'll issue a read with max_recv_bytes==0, deadlocking the flow control code.
Instead, hold off on advertising reading until the buffer gets a little more clear, then start pulling.
pull/3088/head
Craig Tiller 10 years ago
parent d36ed20b7d
commit a0461e52f3
  1. 14
      src/core/surface/call.c

@ -630,9 +630,6 @@ static void unlock(grpc_call *call) {
call->cancel_alarm = 0;
if (!call->receiving && need_more_data(call)) {
op.recv_ops = &call->recv_ops;
op.recv_state = &call->recv_state;
op.on_done_recv = &call->on_done_recv;
if (grpc_bbq_empty(&call->incoming_queue) && call->reading_message) {
op.max_recv_bytes = call->incoming_message_length -
call->incoming_message.length + MAX_RECV_PEEK_AHEAD;
@ -644,9 +641,14 @@ static void unlock(grpc_call *call) {
op.max_recv_bytes = MAX_RECV_PEEK_AHEAD - buffered_bytes;
}
}
call->receiving = 1;
GRPC_CALL_INTERNAL_REF(call, "receiving");
start_op = 1;
if (op.max_recv_bytes != 0) {
op.recv_ops = &call->recv_ops;
op.recv_state = &call->recv_state;
op.on_done_recv = &call->on_done_recv;
call->receiving = 1;
GRPC_CALL_INTERNAL_REF(call, "receiving");
start_op = 1;
}
}
if (!call->sending) {

Loading…
Cancel
Save