diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-06-06 14:43:06 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-06-06 14:43:06 -0700 |
commit | f39f2d6ddef77b407bf17cb7be8c21cc5b37d889 (patch) | |
tree | 1238134b8a02139de6ad2efbe809c73a2fe66772 /src/core | |
parent | f50abfcbc246d9f338b800f2b1c2365520f34e3f (diff) | |
parent | cce361f7ca984200b32738fda355fede7a2ecd58 (diff) |
Merge github.com:grpc/grpc into we-dont-need-no-backup
Conflicts:
test/core/bad_client/bad_client.c
test/core/httpcli/httpcli_test.c
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/httpcli/httpcli.c | 11 | ||||
-rw-r--r-- | src/core/transport/chttp2_transport.c | 11 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/core/httpcli/httpcli.c b/src/core/httpcli/httpcli.c index 1a1bebe9bb..914355a408 100644 --- a/src/core/httpcli/httpcli.c +++ b/src/core/httpcli/httpcli.c @@ -62,6 +62,7 @@ typedef struct { void *user_data; grpc_httpcli_context *context; grpc_pollset *pollset; + grpc_iomgr_object iomgr_obj; } internal_request; static grpc_httpcli_get_override g_get_override = NULL; @@ -89,6 +90,7 @@ static void finish(internal_request *req, int success) { } gpr_slice_unref(req->request_text); gpr_free(req->host); + grpc_iomgr_unregister_object(&req->iomgr_obj); gpr_free(req); } @@ -230,6 +232,7 @@ void grpc_httpcli_get(grpc_httpcli_context *context, grpc_pollset *pollset, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data) { internal_request *req; + char *name; if (g_get_override && g_get_override(request, deadline, on_response, user_data)) { return; @@ -244,6 +247,9 @@ void grpc_httpcli_get(grpc_httpcli_context *context, grpc_pollset *pollset, req->use_ssl = request->use_ssl; req->context = context; req->pollset = pollset; + gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->path); + grpc_iomgr_register_object(&req->iomgr_obj, name); + gpr_free(name); if (req->use_ssl) { req->host = gpr_strdup(request->host); } @@ -259,6 +265,7 @@ void grpc_httpcli_post(grpc_httpcli_context *context, grpc_pollset *pollset, gpr_timespec deadline, grpc_httpcli_response_cb on_response, void *user_data) { internal_request *req; + char *name; if (g_post_override && g_post_override(request, body_bytes, body_size, deadline, on_response, user_data)) { return; @@ -274,10 +281,14 @@ void grpc_httpcli_post(grpc_httpcli_context *context, grpc_pollset *pollset, req->use_ssl = request->use_ssl; req->context = context; req->pollset = pollset; + gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->path); + grpc_iomgr_register_object(&req->iomgr_obj, name); + gpr_free(name); if (req->use_ssl) { req->host = gpr_strdup(request->host); } + grpc_pollset_set_add_pollset(&req->context->pollset_set, req->pollset); grpc_resolve_address(request->host, req->use_ssl ? "https" : "http", on_resolved, req); } diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index d9c712cc63..c4c5a392b3 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1588,12 +1588,21 @@ static int init_goaway_parser(transport *t) { } static int init_settings_frame_parser(transport *t) { - int ok = GRPC_CHTTP2_PARSE_OK == + int ok; + + if (t->incoming_stream_id != 0) { + gpr_log(GPR_ERROR, "settings frame received for stream %d", t->incoming_stream_id); + drop_connection(t); + return 0; + } + + ok = GRPC_CHTTP2_PARSE_OK == grpc_chttp2_settings_parser_begin_frame( &t->simple_parsers.settings, t->incoming_frame_size, t->incoming_frame_flags, t->settings[PEER_SETTINGS]); if (!ok) { drop_connection(t); + return 0; } if (t->incoming_frame_flags & GRPC_CHTTP2_FLAG_ACK) { memcpy(t->settings[ACKED_SETTINGS], t->settings[SENT_SETTINGS], |