diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c index 474a6eb8c1d..4bda734bfaa 100644 --- a/src/core/lib/http/httpcli.c +++ b/src/core/lib/http/httpcli.c @@ -141,12 +141,15 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, internal_request *req = user_data; size_t i; - GRPC_ERROR_REF(error); - - for (i = 0; error == GRPC_ERROR_NONE && i < req->incoming.count; i++) { + for (i = 0; i < req->incoming.count; i++) { if (GPR_SLICE_LENGTH(req->incoming.slices[i])) { req->have_read_byte = 1; - error = grpc_http_parser_parse(&req->parser, req->incoming.slices[i]); + grpc_error *err = + grpc_http_parser_parse(&req->parser, req->incoming.slices[i]); + if (err != GRPC_ERROR_NONE) { + finish(exec_ctx, req, err); + return; + } } } @@ -155,11 +158,8 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, } else if (!req->have_read_byte) { next_address(exec_ctx, req, GRPC_ERROR_REF(error)); } else { - append_error(req, GRPC_ERROR_REF(error)); - finish(exec_ctx, req, error); + finish(exec_ctx, req, grpc_http_parser_eof(&req->parser)); } - - GRPC_ERROR_UNREF(error); } static void on_written(grpc_exec_ctx *exec_ctx, internal_request *req) { diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 98b50294f2f..237611633ec 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -174,7 +174,7 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, tcp->read_cb = NULL; tcp->incoming_buffer = NULL; - cb->cb(exec_ctx, cb->cb_arg, error); + grpc_exec_ctx_push(exec_ctx, cb, error, NULL); } #define MAX_READ_IOVEC 4