Progress converting to new error system (HTTP fixes)

pull/6897/head
Craig Tiller 9 years ago
parent 6a64bfd982
commit e6deeb1089
  1. 16
      src/core/lib/http/httpcli.c
  2. 2
      src/core/lib/iomgr/tcp_posix.c

@ -141,12 +141,15 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
internal_request *req = user_data; internal_request *req = user_data;
size_t i; size_t i;
GRPC_ERROR_REF(error); for (i = 0; i < req->incoming.count; i++) {
for (i = 0; error == GRPC_ERROR_NONE && i < req->incoming.count; i++) {
if (GPR_SLICE_LENGTH(req->incoming.slices[i])) { if (GPR_SLICE_LENGTH(req->incoming.slices[i])) {
req->have_read_byte = 1; 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) { } else if (!req->have_read_byte) {
next_address(exec_ctx, req, GRPC_ERROR_REF(error)); next_address(exec_ctx, req, GRPC_ERROR_REF(error));
} else { } else {
append_error(req, GRPC_ERROR_REF(error)); finish(exec_ctx, req, grpc_http_parser_eof(&req->parser));
finish(exec_ctx, req, error);
} }
GRPC_ERROR_UNREF(error);
} }
static void on_written(grpc_exec_ctx *exec_ctx, internal_request *req) { static void on_written(grpc_exec_ctx *exec_ctx, internal_request *req) {

@ -174,7 +174,7 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp,
tcp->read_cb = NULL; tcp->read_cb = NULL;
tcp->incoming_buffer = 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 #define MAX_READ_IOVEC 4

Loading…
Cancel
Save