aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-20 08:58:01 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-20 08:58:01 -0800
commitd9e6413f33dbf9865a69acd146bae7d6cbaeec52 (patch)
treee7950d8a84c1068284340eee41844b903e06e4d3
parent4a858990ed55978d451a8228b9e0b8d3e94fbd28 (diff)
Fix server side large message receiving
The check for whether to request more data was all messed up. On the client this needs to be after initial metadata is sent to guarantee that we have a live stream, but there's no such requirement at the server. Fix this. I also ran clang-format across the code so there are some formatting changes.
-rw-r--r--src/core/surface/call.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index 40caa93868..7cf3c0e4fd 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -360,8 +360,7 @@ static void unlock(grpc_call *call) {
int num_completed_requests = call->num_completed_requests;
int need_more_data =
call->need_more_data &&
- !call->sending &&
- call->write_state >= WRITE_STATE_STARTED;
+ (call->write_state >= WRITE_STATE_STARTED || !call->is_client);
int i;
if (need_more_data) {
@@ -536,14 +535,16 @@ static void finish_finish_step(void *pc, grpc_op_error error) {
}
static void finish_start_step(void *pc, grpc_op_error error) {
- finish_send_op(pc, GRPC_IOREQ_SEND_INITIAL_METADATA, WRITE_STATE_STARTED, error);
+ finish_send_op(pc, GRPC_IOREQ_SEND_INITIAL_METADATA, WRITE_STATE_STARTED,
+ error);
}
static send_action choose_send_action(grpc_call *call) {
switch (call->write_state) {
case WRITE_STATE_INITIAL:
if (is_op_live(call, GRPC_IOREQ_SEND_INITIAL_METADATA)) {
- if (is_op_live(call, GRPC_IOREQ_SEND_MESSAGE) || is_op_live(call, GRPC_IOREQ_SEND_CLOSE)) {
+ if (is_op_live(call, GRPC_IOREQ_SEND_MESSAGE) ||
+ is_op_live(call, GRPC_IOREQ_SEND_CLOSE)) {
return SEND_BUFFERED_INITIAL_METADATA;
} else {
return SEND_INITIAL_METADATA;