From bc9773e105201cbcc36dd98bf0f8dd12f0fecf7b Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Tue, 10 Feb 2015 22:21:44 +0000 Subject: [PATCH 01/36] Allow _low.Server objects to be passed a ServerCredentials. --- src/python/src/_adapter/_c_test.py | 31 +++++++++++++++++++++++++--- src/python/src/_adapter/_low_test.py | 4 ++-- src/python/src/_adapter/_server.c | 24 +++++++++++++++------ src/python/src/_adapter/fore.py | 2 +- 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/src/python/src/_adapter/_c_test.py b/src/python/src/_adapter/_c_test.py index 19c91ffe018..210ac1fff78 100644 --- a/src/python/src/_adapter/_c_test.py +++ b/src/python/src/_adapter/_c_test.py @@ -92,7 +92,7 @@ class _CTest(unittest.TestCase): _c.init() completion_queue = _c.CompletionQueue() - server = _c.Server(completion_queue) + server = _c.Server(completion_queue, None) server.add_http2_addr('[::]:0') server.start() server.stop() @@ -102,7 +102,7 @@ class _CTest(unittest.TestCase): service_tag = object() completion_queue = _c.CompletionQueue() - server = _c.Server(completion_queue) + server = _c.Server(completion_queue, None) server.add_http2_addr('[::]:0') server.start() server.service(service_tag) @@ -119,7 +119,7 @@ class _CTest(unittest.TestCase): del completion_queue completion_queue = _c.CompletionQueue() - server = _c.Server(completion_queue) + server = _c.Server(completion_queue, None) server.add_http2_addr('[::]:0') server.start() thread = threading.Thread(target=completion_queue.get, args=(_FUTURE,)) @@ -162,6 +162,31 @@ class _CTest(unittest.TestCase): _c.shut_down() + @unittest.skip('TODO(nathaniel): find and use real-enough test credentials') + def test_secure_server(self): + _c.init() + + server_credentials = _c.ServerCredentials( + 'root certificate', (('private key', 'certificate chain'),)) + + completion_queue = _c.CompletionQueue() + server = _c.Server(completion_queue, server_credentials) + server.add_http2_addr('[::]:0') + server.start() + thread = threading.Thread(target=completion_queue.get, args=(_FUTURE,)) + thread.start() + time.sleep(1) + server.stop() + completion_queue.stop() + for _ in range(_IDEMPOTENCE_DEMONSTRATION): + event = completion_queue.get(time.time() + _TIMEOUT) + self.assertIs(event.kind, _datatypes.Event.Kind.STOP) + thread.join() + del server + del completion_queue + + _c.shut_down() + if __name__ == '__main__': unittest.main() diff --git a/src/python/src/_adapter/_low_test.py b/src/python/src/_adapter/_low_test.py index 57b3be66a0e..899ccf53c8a 100644 --- a/src/python/src/_adapter/_low_test.py +++ b/src/python/src/_adapter/_low_test.py @@ -82,7 +82,7 @@ class EchoTest(unittest.TestCase): self.host = 'localhost' self.server_completion_queue = _low.CompletionQueue() - self.server = _low.Server(self.server_completion_queue) + self.server = _low.Server(self.server_completion_queue, None) port = self.server.add_http2_addr('[::]:0') self.server.start() @@ -260,7 +260,7 @@ class CancellationTest(unittest.TestCase): self.host = 'localhost' self.server_completion_queue = _low.CompletionQueue() - self.server = _low.Server(self.server_completion_queue) + self.server = _low.Server(self.server_completion_queue, None) port = self.server.add_http2_addr('[::]:0') self.server.start() diff --git a/src/python/src/_adapter/_server.c b/src/python/src/_adapter/_server.c index d2730d9ae87..503be61ab48 100644 --- a/src/python/src/_adapter/_server.c +++ b/src/python/src/_adapter/_server.c @@ -38,18 +38,30 @@ #include "_adapter/_completion_queue.h" #include "_adapter/_error.h" +#include "_adapter/_server_credentials.h" static int pygrpc_server_init(Server *self, PyObject *args, PyObject *kwds) { const PyObject *completion_queue; - if (!(PyArg_ParseTuple(args, "O!", &pygrpc_CompletionQueueType, - &completion_queue))) { + PyObject *server_credentials; + if (!(PyArg_ParseTuple(args, "O!O", &pygrpc_CompletionQueueType, + &completion_queue, &server_credentials))) { + self->c_server = NULL; + return -1; + } + if (server_credentials == Py_None) { + self->c_server = grpc_server_create( + ((CompletionQueue *)completion_queue)->c_completion_queue, NULL); + return 0; + } else if (PyObject_TypeCheck(server_credentials, + &pygrpc_ServerCredentialsType)) { + self->c_server = grpc_secure_server_create( + ((ServerCredentials *)server_credentials)->c_server_credentials, + ((CompletionQueue *)completion_queue)->c_completion_queue, NULL); + return 0; + } else { self->c_server = NULL; return -1; } - - self->c_server = grpc_server_create( - ((CompletionQueue *)completion_queue)->c_completion_queue, NULL); - return 0; } static void pygrpc_server_dealloc(Server *self) { diff --git a/src/python/src/_adapter/fore.py b/src/python/src/_adapter/fore.py index c307e7ce63a..2f102751f2e 100644 --- a/src/python/src/_adapter/fore.py +++ b/src/python/src/_adapter/fore.py @@ -265,7 +265,7 @@ class ForeLink(ticket_interfaces.ForeLink): """ with self._condition: self._completion_queue = _low.CompletionQueue() - self._server = _low.Server(self._completion_queue) + self._server = _low.Server(self._completion_queue, None) port = self._server.add_http2_addr( '[::]:%d' % (0 if self._port is None else self._port)) self._server.start() From 54b21921f92e27ae004ef5b6e60c23d82ce6c18c Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Wed, 4 Feb 2015 16:39:35 -0800 Subject: [PATCH 02/36] Adding call host (:authority header) check in the secure channel. - Fixes #405. - This change is not tested as it should (only end to end and no negative testing). Will do better when we have testing framework for filters. --- src/core/httpcli/httpcli_security_context.c | 15 +- src/core/security/auth.c | 130 +++++++++++-- src/core/security/secure_transport_setup.c | 3 +- src/core/security/security_context.c | 177 +++++++++++++----- src/core/security/security_context.h | 38 ++-- src/core/surface/secure_channel_create.c | 7 +- test/core/end2end/dualstack_socket_test.c | 7 +- test/core/end2end/tests/cancel_after_accept.c | 4 +- .../cancel_after_accept_and_writes_closed.c | 6 +- ...el_after_accept_and_writes_closed_legacy.c | 4 +- .../tests/cancel_after_accept_legacy.c | 4 +- test/core/end2end/tests/cancel_after_invoke.c | 4 +- .../tests/cancel_after_invoke_legacy.c | 2 +- .../core/end2end/tests/cancel_before_invoke.c | 4 +- .../tests/cancel_before_invoke_legacy.c | 2 +- test/core/end2end/tests/cancel_in_a_vacuum.c | 4 +- .../end2end/tests/cancel_in_a_vacuum_legacy.c | 2 +- .../end2end/tests/census_simple_request.c | 4 +- .../tests/census_simple_request_legacy.c | 4 +- test/core/end2end/tests/disappearing_server.c | 6 +- .../tests/disappearing_server_legacy.c | 4 +- ..._server_shutdown_finishes_inflight_calls.c | 6 +- ..._shutdown_finishes_inflight_calls_legacy.c | 4 +- .../end2end/tests/graceful_server_shutdown.c | 6 +- .../tests/graceful_server_shutdown_legacy.c | 4 +- .../core/end2end/tests/invoke_large_request.c | 6 +- .../tests/invoke_large_request_legacy.c | 4 +- .../end2end/tests/max_concurrent_streams.c | 14 +- .../tests/max_concurrent_streams_legacy.c | 12 +- test/core/end2end/tests/ping_pong_streaming.c | 6 +- .../tests/ping_pong_streaming_legacy.c | 4 +- ...esponse_with_binary_metadata_and_payload.c | 6 +- ..._with_binary_metadata_and_payload_legacy.c | 4 +- ...quest_response_with_metadata_and_payload.c | 6 +- ...esponse_with_metadata_and_payload_legacy.c | 4 +- .../tests/request_response_with_payload.c | 6 +- .../request_response_with_payload_legacy.c | 4 +- ...ponse_with_trailing_metadata_and_payload.c | 6 +- ...ith_trailing_metadata_and_payload_legacy.c | 4 +- .../tests/request_with_large_metadata.c | 6 +- .../request_with_large_metadata_legacy.c | 4 +- .../core/end2end/tests/request_with_payload.c | 6 +- .../tests/request_with_payload_legacy.c | 4 +- .../end2end/tests/simple_delayed_request.c | 6 +- .../tests/simple_delayed_request_legacy.c | 4 +- test/core/end2end/tests/simple_request.c | 6 +- .../end2end/tests/simple_request_legacy.c | 8 +- test/core/end2end/tests/thread_stress.c | 2 +- .../core/end2end/tests/thread_stress_legacy.c | 2 +- .../writes_done_hangs_with_pending_read.c | 6 +- ...ites_done_hangs_with_pending_read_legacy.c | 6 +- 51 files changed, 387 insertions(+), 210 deletions(-) diff --git a/src/core/httpcli/httpcli_security_context.c b/src/core/httpcli/httpcli_security_context.c index d074e163f16..53e887ccd14 100644 --- a/src/core/httpcli/httpcli_security_context.c +++ b/src/core/httpcli/httpcli_security_context.c @@ -73,20 +73,23 @@ static grpc_security_status httpcli_ssl_create_handshaker( return GRPC_SECURITY_OK; } -static grpc_security_status httpcli_ssl_check_peer( - grpc_security_context *ctx, const tsi_peer *peer, - grpc_security_check_peer_cb cb, void *user_data) { +static grpc_security_status httpcli_ssl_check_peer(grpc_security_context *ctx, + tsi_peer peer, + grpc_security_check_cb cb, + void *user_data) { grpc_httpcli_ssl_channel_security_context *c = (grpc_httpcli_ssl_channel_security_context *)ctx; + grpc_security_status status = GRPC_SECURITY_OK; /* Check the peer name. */ if (c->secure_peer_name != NULL && - !tsi_ssl_peer_matches_name(peer, c->secure_peer_name)) { + !tsi_ssl_peer_matches_name(&peer, c->secure_peer_name)) { gpr_log(GPR_ERROR, "Peer name %s is not in peer certificate", c->secure_peer_name); - return GRPC_SECURITY_ERROR; + status = GRPC_SECURITY_ERROR; } - return GRPC_SECURITY_OK; + tsi_peer_destruct(&peer); + return status; } static grpc_security_context_vtable httpcli_ssl_vtable = { diff --git a/src/core/security/auth.c b/src/core/security/auth.c index 9d0c075bc3f..18c32f90f40 100644 --- a/src/core/security/auth.c +++ b/src/core/security/auth.c @@ -35,22 +35,49 @@ #include -#include "src/core/security/security_context.h" -#include "src/core/security/credentials.h" #include #include +#include "src/core/support/string.h" +#include "src/core/channel/channel_stack.h" +#include "src/core/security/security_context.h" +#include "src/core/security/credentials.h" +#include "src/core/surface/call.h" + /* We can have a per-call credentials. */ typedef struct { grpc_credentials *creds; + grpc_mdstr *host; grpc_call_op op; } call_data; /* We can have a per-channel credentials. */ typedef struct { grpc_channel_security_context *security_context; + grpc_mdctx *md_ctx; + grpc_mdstr *authority_string; + grpc_mdstr *error_msg_key; } channel_data; +static void do_nothing(void *ignored, grpc_op_error error) {} + +static void bubbleup_error(grpc_call_element *elem, const char *error_msg) { + grpc_call_op finish_op; + channel_data *channeld = elem->channel_data; + + gpr_log(GPR_ERROR, "%s", error_msg); + finish_op.type = GRPC_RECV_METADATA; + finish_op.dir = GRPC_CALL_UP; + finish_op.flags = 0; + finish_op.data.metadata = grpc_mdelem_from_metadata_strings( + channeld->md_ctx, channeld->error_msg_key, + grpc_mdstr_from_string(channeld->md_ctx, error_msg)); + finish_op.done_cb = do_nothing; + finish_op.user_data = NULL; + grpc_call_next_op(elem, &finish_op); + grpc_call_element_send_cancel(elem); +} + static void on_credentials_metadata(void *user_data, grpc_mdelem **md_elems, size_t num_md, grpc_credentials_status status) { @@ -62,6 +89,46 @@ static void on_credentials_metadata(void *user_data, grpc_mdelem **md_elems, grpc_call_next_op(elem, &((call_data *)elem->call_data)->op); } +static void send_security_metadata(grpc_call_element *elem, grpc_call_op *op) { + /* grab pointers to our data from the call element */ + call_data *calld = elem->call_data; + channel_data *channeld = elem->channel_data; + + grpc_credentials *channel_creds = + channeld->security_context->request_metadata_creds; + /* TODO(jboeuf): + Decide on the policy in this case: + - populate both channel and call? + - the call takes precedence over the channel? + - leave this decision up to the channel credentials? */ + if (calld->creds != NULL) { + gpr_log(GPR_ERROR, "Ignoring per call credentials for now."); + } + if (channel_creds != NULL && + grpc_credentials_has_request_metadata(channel_creds)) { + calld->op = *op; /* Copy op (originates from the caller's stack). */ + grpc_credentials_get_request_metadata(channel_creds, + on_credentials_metadata, elem); + } else { + grpc_call_next_op(elem, op); + } +} + +static void on_host_checked(void *user_data, grpc_security_status status) { + grpc_call_element *elem = (grpc_call_element *)user_data; + call_data *calld = elem->call_data; + + if (status == GRPC_SECURITY_OK) { + send_security_metadata(elem, &calld->op); + } else { + char *error_msg; + gpr_asprintf(&error_msg, "Invalid host %s set in :authority metadata.", + grpc_mdstr_as_c_string(calld->host)); + bubbleup_error(elem, error_msg); + gpr_free(error_msg); + } +} + /* Called either: - in response to an API call (or similar) from above, to send something - a network event (or similar) from below, to receive something @@ -74,26 +141,36 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, channel_data *channeld = elem->channel_data; switch (op->type) { - case GRPC_SEND_START: { - grpc_credentials *channel_creds = - channeld->security_context->request_metadata_creds; - /* TODO(jboeuf): - Decide on the policy in this case: - - populate both channel and call? - - the call takes precedence over the channel? - - leave this decision up to the channel credentials? */ - if (calld->creds != NULL) { - gpr_log(GPR_ERROR, "Ignoring per call credentials for now."); + case GRPC_SEND_METADATA: + /* Pointer comparison is OK for md_elems created from the same context. */ + if (op->data.metadata->key == channeld->authority_string) { + if (calld->host != NULL) grpc_mdstr_unref(calld->host); + calld->host = grpc_mdstr_ref(op->data.metadata->value); } - if (channel_creds != NULL && - grpc_credentials_has_request_metadata(channel_creds)) { + grpc_call_next_op(elem, op); + break; + + case GRPC_SEND_START: + if (calld->host != NULL) { + grpc_security_status status; + const char *call_host = grpc_mdstr_as_c_string(calld->host); calld->op = *op; /* Copy op (originates from the caller's stack). */ - grpc_credentials_get_request_metadata(channel_creds, - on_credentials_metadata, elem); - break; + status = grpc_channel_security_context_check_call_host( + channeld->security_context, call_host, on_host_checked, elem); + if (status != GRPC_SECURITY_OK) { + if (status == GRPC_SECURITY_ERROR) { + char *error_msg; + gpr_asprintf(&error_msg, + "Invalid host %s set in :authority metadata.", + call_host); + bubbleup_error(elem, error_msg); + gpr_free(error_msg); + } + break; + } } - /* FALLTHROUGH INTENDED. */ - } + send_security_metadata(elem, op); + break; default: /* pass control up or down the stack depending on op->dir */ @@ -116,6 +193,7 @@ static void init_call_elem(grpc_call_element *elem, Find a way to pass-in the credentials from the caller here. */ call_data *calld = elem->call_data; calld->creds = NULL; + calld->host = NULL; } /* Destructor for call_data */ @@ -124,6 +202,9 @@ static void destroy_call_elem(grpc_call_element *elem) { if (calld->creds != NULL) { grpc_credentials_unref(calld->creds); } + if (calld->host != NULL) { + grpc_mdstr_unref(calld->host); + } } /* Constructor for channel_data */ @@ -146,6 +227,11 @@ static void init_channel_elem(grpc_channel_element *elem, GPR_ASSERT(ctx->is_client_side); channeld->security_context = (grpc_channel_security_context *)grpc_security_context_ref(ctx); + channeld->md_ctx = metadata_context; + channeld->authority_string = + grpc_mdstr_from_string(channeld->md_ctx, ":authority"); + channeld->error_msg_key = + grpc_mdstr_from_string(channeld->md_ctx, "grpc-message"); } /* Destructor for channel data */ @@ -154,6 +240,12 @@ static void destroy_channel_elem(grpc_channel_element *elem) { channel_data *channeld = elem->channel_data; grpc_channel_security_context *ctx = channeld->security_context; if (ctx != NULL) grpc_security_context_unref(&ctx->base); + if (channeld->authority_string != NULL) { + grpc_mdstr_unref(channeld->authority_string); + } + if (channeld->error_msg_key != NULL) { + grpc_mdstr_unref(channeld->error_msg_key); + } } const grpc_channel_filter grpc_client_auth_filter = { diff --git a/src/core/security/secure_transport_setup.c b/src/core/security/secure_transport_setup.c index 50a6987fbf7..59789a7e4de 100644 --- a/src/core/security/secure_transport_setup.c +++ b/src/core/security/secure_transport_setup.c @@ -113,8 +113,7 @@ static void check_peer(grpc_secure_transport_setup *s) { return; } peer_status = - grpc_security_context_check_peer(s->ctx, &peer, on_peer_checked, s); - tsi_peer_destruct(&peer); + grpc_security_context_check_peer(s->ctx, peer, on_peer_checked, s); if (peer_status == GRPC_SECURITY_ERROR) { gpr_log(GPR_ERROR, "Peer check failed."); secure_transport_setup_done(s, 0); diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c index 1edec297759..adb02697925 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -69,12 +69,22 @@ grpc_security_status grpc_security_context_create_handshaker( } grpc_security_status grpc_security_context_check_peer( - grpc_security_context *ctx, const tsi_peer *peer, - grpc_security_check_peer_cb cb, void *user_data) { - if (ctx == NULL) return GRPC_SECURITY_ERROR; + grpc_security_context *ctx, tsi_peer peer, grpc_security_check_cb cb, + void *user_data) { + if (ctx == NULL) { + tsi_peer_destruct(&peer); + return GRPC_SECURITY_ERROR; + } return ctx->vtable->check_peer(ctx, peer, cb, user_data); } +grpc_security_status grpc_channel_security_context_check_call_host( + grpc_channel_security_context *ctx, const char *host, + grpc_security_check_cb cb, void *user_data) { + if (ctx == NULL || ctx->check_call_host == NULL) return GRPC_SECURITY_ERROR; + return ctx->check_call_host(ctx, host, cb, user_data); +} + void grpc_security_context_unref(grpc_security_context *ctx) { if (ctx == NULL) return; if (gpr_unref(&ctx->refcount)) ctx->vtable->destroy(ctx); @@ -137,6 +147,11 @@ static int check_request_metadata_creds(grpc_credentials *creds) { /* -- Fake implementation. -- */ +typedef struct { + grpc_channel_security_context base; + int call_host_check_is_async; +} grpc_fake_channel_security_context; + static void fake_channel_destroy(grpc_security_context *ctx) { grpc_channel_security_context *c = (grpc_channel_security_context *)ctx; grpc_credentials_unref(c->request_metadata_creds); @@ -158,31 +173,51 @@ static grpc_security_status fake_server_create_handshaker( } static grpc_security_status fake_check_peer(grpc_security_context *ctx, - const tsi_peer *peer, - grpc_security_check_peer_cb cb, + tsi_peer peer, + grpc_security_check_cb cb, void *user_data) { const char *prop_name; - if (peer->property_count != 1) { + grpc_security_status status = GRPC_SECURITY_OK; + if (peer.property_count != 1) { gpr_log(GPR_ERROR, "Fake peers should only have 1 property."); - return GRPC_SECURITY_ERROR; + status = GRPC_SECURITY_ERROR; + goto end; } - prop_name = peer->properties[0].name; + prop_name = peer.properties[0].name; if (prop_name == NULL || strcmp(prop_name, TSI_CERTIFICATE_TYPE_PEER_PROPERTY)) { gpr_log(GPR_ERROR, "Unexpected property in fake peer: %s.", prop_name == NULL ? "" : prop_name); - return GRPC_SECURITY_ERROR; + status = GRPC_SECURITY_ERROR; + goto end; } - if (peer->properties[0].type != TSI_PEER_PROPERTY_TYPE_STRING) { + if (peer.properties[0].type != TSI_PEER_PROPERTY_TYPE_STRING) { gpr_log(GPR_ERROR, "Invalid type of cert type property."); - return GRPC_SECURITY_ERROR; + status = GRPC_SECURITY_ERROR; + goto end; } - if (strncmp(peer->properties[0].value.string.data, TSI_FAKE_CERTIFICATE_TYPE, - peer->properties[0].value.string.length)) { + if (strncmp(peer.properties[0].value.string.data, TSI_FAKE_CERTIFICATE_TYPE, + peer.properties[0].value.string.length)) { gpr_log(GPR_ERROR, "Invalid value for cert type property."); - return GRPC_SECURITY_ERROR; + status = GRPC_SECURITY_ERROR; + goto end; + } +end: + tsi_peer_destruct(&peer); + return status; +} + +static grpc_security_status fake_channel_check_call_host( + grpc_channel_security_context *ctx, const char *host, + grpc_security_check_cb cb, void *user_data) { + grpc_fake_channel_security_context *c = + (grpc_fake_channel_security_context *)ctx; + if (c->call_host_check_is_async) { + cb(user_data, GRPC_SECURITY_OK); + return GRPC_SECURITY_PENDING; + } else { + return GRPC_SECURITY_OK; } - return GRPC_SECURITY_OK; } static grpc_security_context_vtable fake_channel_vtable = { @@ -192,15 +227,17 @@ static grpc_security_context_vtable fake_server_vtable = { fake_server_destroy, fake_server_create_handshaker, fake_check_peer}; grpc_channel_security_context *grpc_fake_channel_security_context_create( - grpc_credentials *request_metadata_creds) { - grpc_channel_security_context *c = - gpr_malloc(sizeof(grpc_channel_security_context)); - gpr_ref_init(&c->base.refcount, 1); - c->base.is_client_side = 1; - c->base.vtable = &fake_channel_vtable; + grpc_credentials *request_metadata_creds, int call_host_check_is_async) { + grpc_fake_channel_security_context *c = + gpr_malloc(sizeof(grpc_fake_channel_security_context)); + gpr_ref_init(&c->base.base.refcount, 1); + c->base.base.is_client_side = 1; + c->base.base.vtable = &fake_channel_vtable; GPR_ASSERT(check_request_metadata_creds(request_metadata_creds)); - c->request_metadata_creds = grpc_credentials_ref(request_metadata_creds); - return c; + c->base.request_metadata_creds = grpc_credentials_ref(request_metadata_creds); + c->base.check_call_host = fake_channel_check_call_host; + c->call_host_check_is_async = call_host_check_is_async; + return &c->base; } grpc_security_context *grpc_fake_server_security_context_create(void) { @@ -215,7 +252,9 @@ grpc_security_context *grpc_fake_server_security_context_create(void) { typedef struct { grpc_channel_security_context base; tsi_ssl_handshaker_factory *handshaker_factory; - char *secure_peer_name; + char *target_name; + char *overridden_target_name; + tsi_peer peer; } grpc_ssl_channel_security_context; typedef struct { @@ -230,7 +269,9 @@ static void ssl_channel_destroy(grpc_security_context *ctx) { if (c->handshaker_factory != NULL) { tsi_ssl_handshaker_factory_destroy(c->handshaker_factory); } - if (c->secure_peer_name != NULL) gpr_free(c->secure_peer_name); + if (c->target_name != NULL) gpr_free(c->target_name); + if (c->overridden_target_name != NULL) gpr_free(c->overridden_target_name); + tsi_peer_destruct(&c->peer); gpr_free(ctx); } @@ -244,11 +285,11 @@ static void ssl_server_destroy(grpc_security_context *ctx) { static grpc_security_status ssl_create_handshaker( tsi_ssl_handshaker_factory *handshaker_factory, int is_client, - const char *secure_peer_name, tsi_handshaker **handshaker) { + const char *peer_name, tsi_handshaker **handshaker) { tsi_result result = TSI_OK; if (handshaker_factory == NULL) return GRPC_SECURITY_ERROR; result = tsi_ssl_handshaker_factory_create_handshaker( - handshaker_factory, is_client ? secure_peer_name : NULL, handshaker); + handshaker_factory, is_client ? peer_name : NULL, handshaker); if (result != TSI_OK) { gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.", tsi_result_to_string(result)); @@ -261,7 +302,10 @@ static grpc_security_status ssl_channel_create_handshaker( grpc_security_context *ctx, tsi_handshaker **handshaker) { grpc_ssl_channel_security_context *c = (grpc_ssl_channel_security_context *)ctx; - return ssl_create_handshaker(c->handshaker_factory, 1, c->secure_peer_name, + return ssl_create_handshaker(c->handshaker_factory, 1, + c->overridden_target_name != NULL + ? c->overridden_target_name + : c->target_name, handshaker); } @@ -271,7 +315,7 @@ static grpc_security_status ssl_server_create_handshaker( return ssl_create_handshaker(c->handshaker_factory, 0, NULL, handshaker); } -static grpc_security_status ssl_check_peer(const char *secure_peer_name, +static grpc_security_status ssl_check_peer(const char *peer_name, const tsi_peer *peer) { /* Check the ALPN. */ const tsi_peer_property *p = @@ -291,28 +335,54 @@ static grpc_security_status ssl_check_peer(const char *secure_peer_name, } /* Check the peer name if specified. */ - if (secure_peer_name != NULL && - !tsi_ssl_peer_matches_name(peer, secure_peer_name)) { - gpr_log(GPR_ERROR, "Peer name %s is not in peer certificate", - secure_peer_name); + if (peer_name != NULL && + !tsi_ssl_peer_matches_name(peer, peer_name)) { + gpr_log(GPR_ERROR, "Peer name %s is not in peer certificate", peer_name); return GRPC_SECURITY_ERROR; } return GRPC_SECURITY_OK; } -static grpc_security_status ssl_channel_check_peer( - grpc_security_context *ctx, const tsi_peer *peer, - grpc_security_check_peer_cb cb, void *user_data) { +static grpc_security_status ssl_channel_check_peer(grpc_security_context *ctx, + tsi_peer peer, + grpc_security_check_cb cb, + void *user_data) { grpc_ssl_channel_security_context *c = (grpc_ssl_channel_security_context *)ctx; - return ssl_check_peer(c->secure_peer_name, peer); + grpc_security_status status = ssl_check_peer(c->overridden_target_name != NULL + ? c->overridden_target_name + : c->target_name, + &peer); + c->peer = peer; + return status; +} + +static grpc_security_status ssl_server_check_peer(grpc_security_context *ctx, + tsi_peer peer, + grpc_security_check_cb cb, + void *user_data) { + /* TODO(jboeuf): Find a way to expose the peer to the authorization layer. */ + grpc_security_status status = ssl_check_peer(NULL, &peer); + tsi_peer_destruct(&peer); + return status; } -static grpc_security_status ssl_server_check_peer( - grpc_security_context *ctx, const tsi_peer *peer, - grpc_security_check_peer_cb cb, void *user_data) { - /* TODO(jboeuf): Find a way to expose the peer to the authorization layer. */ - return ssl_check_peer(NULL, peer); +static grpc_security_status ssl_channel_check_call_host( + grpc_channel_security_context *ctx, const char *host, + grpc_security_check_cb cb, void *user_data) { + grpc_ssl_channel_security_context *c = + (grpc_ssl_channel_security_context *)ctx; + + if (tsi_ssl_peer_matches_name(&c->peer, host)) return GRPC_SECURITY_OK; + + /* If the target name was overridden, then the original target_name was + 'checked' transitively during the previous peer check at the end of the + handshake. */ + if (c->overridden_target_name != NULL && !strcmp(host, c->target_name)) { + return GRPC_SECURITY_OK; + } else { + return GRPC_SECURITY_ERROR; + } } static grpc_security_context_vtable ssl_channel_vtable = { @@ -345,7 +415,8 @@ static size_t get_default_pem_roots(const unsigned char **pem_root_certs) { grpc_security_status grpc_ssl_channel_security_context_create( grpc_credentials *request_metadata_creds, const grpc_ssl_config *config, - const char *secure_peer_name, grpc_channel_security_context **ctx) { + const char *target_name, const char *overridden_target_name, + grpc_channel_security_context **ctx) { size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions(); const unsigned char **alpn_protocol_strings = gpr_malloc(sizeof(const char *) * num_alpn_protocols); @@ -364,8 +435,8 @@ grpc_security_status grpc_ssl_channel_security_context_create( strlen(grpc_chttp2_get_alpn_version_index(i)); } - if (config == NULL || secure_peer_name == NULL) { - gpr_log(GPR_ERROR, "An ssl channel needs a config and a secure name."); + if (config == NULL || target_name == NULL) { + gpr_log(GPR_ERROR, "An ssl channel needs a config and a target name."); goto error; } if (!check_request_metadata_creds(request_metadata_creds)) { @@ -379,8 +450,12 @@ grpc_security_status grpc_ssl_channel_security_context_create( c->base.base.vtable = &ssl_channel_vtable; c->base.base.is_client_side = 1; c->base.request_metadata_creds = grpc_credentials_ref(request_metadata_creds); - if (secure_peer_name != NULL) { - c->secure_peer_name = gpr_strdup(secure_peer_name); + c->base.check_call_host = ssl_channel_check_call_host; + if (target_name != NULL) { + c->target_name = gpr_strdup(target_name); + } + if (overridden_target_name != NULL) { + c->overridden_target_name = gpr_strdup(overridden_target_name); } if (config->pem_root_certs == NULL) { pem_root_certs_size = get_default_pem_roots(&pem_root_certs); @@ -478,7 +553,7 @@ grpc_channel *grpc_ssl_channel_create(grpc_credentials *ssl_creds, grpc_channel *channel = NULL; grpc_security_status status = GRPC_SECURITY_OK; size_t i = 0; - const char *secure_peer_name = target; + const char *overridden_target_name = NULL; grpc_arg arg; grpc_channel_args *new_args; @@ -486,13 +561,13 @@ grpc_channel *grpc_ssl_channel_create(grpc_credentials *ssl_creds, grpc_arg *arg = &args->args[i]; if (!strcmp(arg->key, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG) && arg->type == GRPC_ARG_STRING) { - secure_peer_name = arg->value.string; + overridden_target_name = arg->value.string; break; } } status = grpc_ssl_channel_security_context_create( request_metadata_creds, grpc_ssl_credentials_get_config(ssl_creds), - secure_peer_name, &ctx); + target, overridden_target_name, &ctx); if (status != GRPC_SECURITY_OK) { return grpc_lame_client_channel_create(); } @@ -510,7 +585,7 @@ grpc_channel *grpc_fake_transport_security_channel_create( grpc_credentials *fake_creds, grpc_credentials *request_metadata_creds, const char *target, const grpc_channel_args *args) { grpc_channel_security_context *ctx = - grpc_fake_channel_security_context_create(request_metadata_creds); + grpc_fake_channel_security_context_create(request_metadata_creds, 1); grpc_channel *channel = grpc_secure_channel_create_internal(target, args, ctx); grpc_security_context_unref(&ctx->base); diff --git a/src/core/security/security_context.h b/src/core/security/security_context.h index 2caa2d36900..25d467d7171 100644 --- a/src/core/security/security_context.h +++ b/src/core/security/security_context.h @@ -56,16 +56,15 @@ typedef struct grpc_security_context grpc_security_context; #define GRPC_SECURITY_CONTEXT_ARG "grpc.security_context" -typedef void (*grpc_security_check_peer_cb)(void *user_data, - grpc_security_status status); +typedef void (*grpc_security_check_cb)(void *user_data, + grpc_security_status status); typedef struct { void (*destroy)(grpc_security_context *ctx); grpc_security_status (*create_handshaker)(grpc_security_context *ctx, tsi_handshaker **handshaker); - grpc_security_status (*check_peer)(grpc_security_context *ctx, - const tsi_peer *peer, - grpc_security_check_peer_cb, + grpc_security_status (*check_peer)(grpc_security_context *ctx, tsi_peer peer, + grpc_security_check_cb cb, void *user_data); } grpc_security_context_vtable; @@ -87,18 +86,14 @@ grpc_security_status grpc_security_context_create_handshaker( /* Check the peer. Implementations can choose to check the peer either synchronously or - asynchronously. In the first case, a successful will return + asynchronously. In the first case, a successful call will return GRPC_SECURITY_OK. In the asynchronous case, the call will return GRPC_SECURITY_PENDING unless an error is detected early on. - - Note: - Asynchronous implementations of this interface should make a copy of the - fields of the peer they want to check as there is no guarantee on the - lifetime of the peer object beyond this call. + Ownership of the peer is transfered. */ grpc_security_status grpc_security_context_check_peer( - grpc_security_context *ctx, const tsi_peer *peer, - grpc_security_check_peer_cb cb, void *user_data); + grpc_security_context *ctx, tsi_peer peer, + grpc_security_check_cb cb, void *user_data); /* Util to encapsulate the context in a channel arg. */ grpc_arg grpc_security_context_to_arg(grpc_security_context *ctx); @@ -120,14 +115,26 @@ typedef struct grpc_channel_security_context grpc_channel_security_context; struct grpc_channel_security_context { grpc_security_context base; /* requires is_client_side to be non 0. */ grpc_credentials *request_metadata_creds; + grpc_security_status (*check_call_host)( + grpc_channel_security_context *ctx, const char *host, + grpc_security_check_cb cb, void *user_data); }; +/* Checks that the host that will be set for a call is acceptable. + Implementations can choose do the check either synchronously or + asynchronously. In the first case, a successful call will return + GRPC_SECURITY_OK. In the asynchronous case, the call will return + GRPC_SECURITY_PENDING unless an error is detected early on. */ +grpc_security_status grpc_channel_security_context_check_call_host( + grpc_channel_security_context *ctx, const char *host, + grpc_security_check_cb cb, void *user_data); + /* --- Creation security contexts. --- */ /* For TESTING ONLY! Creates a fake context that emulates real channel security. */ grpc_channel_security_context *grpc_fake_channel_security_context_create( - grpc_credentials *request_metadata_creds); + grpc_credentials *request_metadata_creds, int call_host_check_is_async); /* For TESTING ONLY! Creates a fake context that emulates real server security. */ @@ -148,7 +155,8 @@ grpc_security_context *grpc_fake_server_security_context_create(void); */ grpc_security_status grpc_ssl_channel_security_context_create( grpc_credentials *request_metadata_creds, const grpc_ssl_config *config, - const char *secure_peer_name, grpc_channel_security_context **ctx); + const char *target_name, const char *overridden_target_name, + grpc_channel_security_context **ctx); /* Creates an SSL server_security_context. - config is the SSL config to be used for the SSL channel establishment. diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c index defee797666..562e27ff6d4 100644 --- a/src/core/surface/secure_channel_create.c +++ b/src/core/surface/secure_channel_create.c @@ -189,8 +189,8 @@ static void done_setup(void *sp) { static grpc_transport_setup_result complete_setup(void *channel_stack, grpc_transport *transport, grpc_mdctx *mdctx) { - static grpc_channel_filter const *extra_filters[] = {&grpc_http_client_filter, - &grpc_http_filter}; + static grpc_channel_filter const *extra_filters[] = { + &grpc_client_auth_filter, &grpc_http_client_filter, &grpc_http_filter}; return grpc_client_channel_transport_setup_complete( channel_stack, transport, extra_filters, GPR_ARRAY_SIZE(extra_filters), mdctx); @@ -208,7 +208,7 @@ grpc_channel *grpc_secure_channel_create_internal( grpc_arg context_arg; grpc_channel_args *args_copy; grpc_mdctx *mdctx = grpc_mdctx_create(); -#define MAX_FILTERS 4 +#define MAX_FILTERS 3 const grpc_channel_filter *filters[MAX_FILTERS]; int n = 0; if (grpc_find_security_context_in_args(args) != NULL) { @@ -222,7 +222,6 @@ grpc_channel *grpc_secure_channel_create_internal( if (grpc_channel_args_is_census_enabled(args)) { filters[n++] = &grpc_client_census_filter; } - filters[n++] = &grpc_client_auth_filter; filters[n++] = &grpc_client_channel_filter; GPR_ASSERT(n <= MAX_FILTERS); channel = grpc_channel_create_from_filters(filters, n, args_copy, mdctx, 1); diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 9d893f67a13..a61644f583c 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -112,7 +112,8 @@ void test_connect(const char *server_host, const char *client_host, int port, } /* Send a trivial request. */ - c = grpc_channel_create_call_old(client, "/foo", "test.google.com", deadline); + c = grpc_channel_create_call_old(client, "/foo", "foo.test.google.com", + deadline); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == @@ -124,8 +125,8 @@ void test_connect(const char *server_host, const char *client_host, int port, cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index eb26ff14f00..18d6bcec06e 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -131,8 +131,8 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_byte_buffer_create(&response_payload_slice, 1); int was_cancelled = 2; - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c index b8a1438ca43..889db541624 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c @@ -113,7 +113,7 @@ static void test_cancel_after_accept_and_writes_closed( cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -121,8 +121,8 @@ static void test_cancel_after_accept_and_writes_closed( grpc_call_invoke_old(c, f.client_cq, tag(2), tag(3), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c index b8a1438ca43..24596662422 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c @@ -113,7 +113,7 @@ static void test_cancel_after_accept_and_writes_closed( cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -121,7 +121,7 @@ static void test_cancel_after_accept_and_writes_closed( grpc_call_invoke_old(c, f.client_cq, tag(2), tag(3), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/cancel_after_accept_legacy.c b/test/core/end2end/tests/cancel_after_accept_legacy.c index f9bf9fabf40..e87f7d648c2 100644 --- a/test/core/end2end/tests/cancel_after_accept_legacy.c +++ b/test/core/end2end/tests/cancel_after_accept_legacy.c @@ -113,7 +113,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -121,7 +121,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_call_invoke_old(c, f.client_cq, tag(2), tag(3), 0)); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 96a8186d15e..7f7c1e6597d 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -124,8 +124,8 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_byte_buffer *request_payload = grpc_byte_buffer_create(&request_payload_slice, 1); - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); diff --git a/test/core/end2end/tests/cancel_after_invoke_legacy.c b/test/core/end2end/tests/cancel_after_invoke_legacy.c index 8b282230405..7a656f1cb0b 100644 --- a/test/core/end2end/tests/cancel_after_invoke_legacy.c +++ b/test/core/end2end/tests/cancel_after_invoke_legacy.c @@ -111,7 +111,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.client_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 63e7f09dd5f..663db5290d1 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -122,8 +122,8 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, int test_ grpc_byte_buffer *request_payload = grpc_byte_buffer_create(&request_payload_slice, 1); - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c)); diff --git a/test/core/end2end/tests/cancel_before_invoke_legacy.c b/test/core/end2end/tests/cancel_before_invoke_legacy.c index 5851277d201..cdd4b43447a 100644 --- a/test/core/end2end/tests/cancel_before_invoke_legacy.c +++ b/test/core/end2end/tests/cancel_before_invoke_legacy.c @@ -109,7 +109,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.client_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index e493941f0a0..e19d28a41ed 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -109,8 +109,8 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.client_cq); - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c)); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c b/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c index 6b5194fb07f..c9870896c00 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c @@ -109,7 +109,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_time(); cq_verifier *v_client = cq_verifier_create(f.client_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c index 4cbaa65b321..f144cd17aa1 100644 --- a/test/core/end2end/tests/census_simple_request.c +++ b/test/core/end2end/tests/census_simple_request.c @@ -106,7 +106,7 @@ static void test_body(grpc_end2end_test_fixture f) { cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); tag(1); @@ -118,7 +118,7 @@ static void test_body(grpc_end2end_test_fixture f) { cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/census_simple_request_legacy.c b/test/core/end2end/tests/census_simple_request_legacy.c index 4cbaa65b321..f144cd17aa1 100644 --- a/test/core/end2end/tests/census_simple_request_legacy.c +++ b/test/core/end2end/tests/census_simple_request_legacy.c @@ -106,7 +106,7 @@ static void test_body(grpc_end2end_test_fixture f) { cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); tag(1); @@ -118,7 +118,7 @@ static void test_body(grpc_end2end_test_fixture f) { cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 9b2f16890bd..07de01059cc 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -97,7 +97,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, grpc_call *s; gpr_timespec deadline = five_seconds_time(); - c = grpc_channel_create_call_old(f->client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f->client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -109,8 +109,8 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f->server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/disappearing_server_legacy.c b/test/core/end2end/tests/disappearing_server_legacy.c index 9b2f16890bd..b75b268647c 100644 --- a/test/core/end2end/tests/disappearing_server_legacy.c +++ b/test/core/end2end/tests/disappearing_server_legacy.c @@ -97,7 +97,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, grpc_call *s; gpr_timespec deadline = five_seconds_time(); - c = grpc_channel_create_call_old(f->client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f->client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -109,7 +109,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f->server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c index a9d34e2db5a..65de02ac1f0 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c @@ -111,7 +111,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -123,8 +123,8 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c index a9d34e2db5a..6b920bb4ade 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c @@ -111,7 +111,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -123,7 +123,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index dcd6192799a..65972a756e8 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -110,7 +110,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -122,8 +122,8 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/graceful_server_shutdown_legacy.c b/test/core/end2end/tests/graceful_server_shutdown_legacy.c index dcd6192799a..20394965d30 100644 --- a/test/core/end2end/tests/graceful_server_shutdown_legacy.c +++ b/test/core/end2end/tests/graceful_server_shutdown_legacy.c @@ -110,7 +110,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -122,7 +122,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 7774fe4521d..10c1e0befb5 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -122,7 +122,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -138,8 +138,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { request (as this request is very large) */ cq_verify_empty(v_client); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/invoke_large_request_legacy.c b/test/core/end2end/tests/invoke_large_request_legacy.c index 7774fe4521d..8982d027012 100644 --- a/test/core/end2end/tests/invoke_large_request_legacy.c +++ b/test/core/end2end/tests/invoke_large_request_legacy.c @@ -122,7 +122,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -138,7 +138,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { request (as this request is very large) */ cq_verify_empty(v_client); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 4830b85f9b7..2ea8645ea71 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -109,7 +109,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -121,8 +121,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == @@ -182,10 +182,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { /* start two requests - ensuring that the second is not accepted until the first completes */ deadline = five_seconds_time(); - c1 = grpc_channel_create_call_old(f.client, "/alpha", "test.google.com", + c1 = grpc_channel_create_call_old(f.client, "/alpha", "foo.test.google.com", deadline); GPR_ASSERT(c1); - c2 = grpc_channel_create_call_old(f.client, "/beta", "test.google.com", + c2 = grpc_channel_create_call_old(f.client, "/beta", "foo.test.google.com", deadline); GPR_ASSERT(c1); @@ -211,7 +211,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { cq_expect_server_rpc_new(v_server, &s1, tag(100), live_call == 300 ? "/alpha" : "/beta", - "test.google.com", deadline, NULL); + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == @@ -237,7 +237,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(200))); cq_expect_server_rpc_new(v_server, &s2, tag(200), live_call == 300 ? "/alpha" : "/beta", - "test.google.com", deadline, NULL); + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/max_concurrent_streams_legacy.c b/test/core/end2end/tests/max_concurrent_streams_legacy.c index 4830b85f9b7..d15368182a0 100644 --- a/test/core/end2end/tests/max_concurrent_streams_legacy.c +++ b/test/core/end2end/tests/max_concurrent_streams_legacy.c @@ -109,7 +109,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -121,7 +121,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); @@ -182,10 +182,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { /* start two requests - ensuring that the second is not accepted until the first completes */ deadline = five_seconds_time(); - c1 = grpc_channel_create_call_old(f.client, "/alpha", "test.google.com", + c1 = grpc_channel_create_call_old(f.client, "/alpha", "foo.test.google.com", deadline); GPR_ASSERT(c1); - c2 = grpc_channel_create_call_old(f.client, "/beta", "test.google.com", + c2 = grpc_channel_create_call_old(f.client, "/beta", "foo.test.google.com", deadline); GPR_ASSERT(c1); @@ -211,7 +211,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { cq_expect_server_rpc_new(v_server, &s1, tag(100), live_call == 300 ? "/alpha" : "/beta", - "test.google.com", deadline, NULL); + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == @@ -237,7 +237,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(200))); cq_expect_server_rpc_new(v_server, &s2, tag(200), live_call == 300 ? "/alpha" : "/beta", - "test.google.com", deadline, NULL); + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 0c034a1996e..4e27be16b4a 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -118,7 +118,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, cq_verifier *v_server = cq_verifier_create(f.server_cq); gpr_log(GPR_INFO, "testing with %d message pairs.", messages); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -127,8 +127,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == grpc_call_server_accept_old(s, f.server_cq, tag(102))); diff --git a/test/core/end2end/tests/ping_pong_streaming_legacy.c b/test/core/end2end/tests/ping_pong_streaming_legacy.c index 0c034a1996e..cd1d03e4cd8 100644 --- a/test/core/end2end/tests/ping_pong_streaming_legacy.c +++ b/test/core/end2end/tests/ping_pong_streaming_legacy.c @@ -118,7 +118,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, cq_verifier *v_server = cq_verifier_create(f.server_cq); gpr_log(GPR_INFO, "testing with %d message pairs.", messages); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -127,7 +127,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c index fa5df5f5260..940e327d22d 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c @@ -139,8 +139,8 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -209,7 +209,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "test.google.com")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.com")); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c index daadcf619be..b5e4eea6c86 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c @@ -137,7 +137,7 @@ static void test_request_response_with_metadata_and_payload( gpr_slice_unref(request_payload_slice); gpr_slice_unref(response_payload_slice); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -157,7 +157,7 @@ static void test_request_response_with_metadata_and_payload( cq_verify(v_client); cq_expect_server_rpc_new( - v_server, &s, tag(100), "/foo", "test.google.com", deadline, "key1-bin", + v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, "key1-bin", "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", "key2-bin", "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c index ad01fe70813..80cb629542b 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c @@ -132,8 +132,8 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -202,7 +202,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "test.google.com")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.com")); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c index 0a58398c4ae..a86e1aa7f95 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c @@ -128,7 +128,7 @@ static void test_request_response_with_metadata_and_payload( gpr_slice_unref(request_payload_slice); gpr_slice_unref(response_payload_slice); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -147,7 +147,7 @@ static void test_request_response_with_metadata_and_payload( cq_expect_write_accepted(v_client, tag(4), GRPC_OP_OK); cq_verify(v_client); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, "key1", "val1", "key2", "val2", NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c index 6b60c4da651..b07f51da85e 100644 --- a/test/core/end2end/tests/request_response_with_payload.c +++ b/test/core/end2end/tests/request_response_with_payload.c @@ -127,8 +127,8 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -195,7 +195,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "test.google.com")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.com")); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/request_response_with_payload_legacy.c b/test/core/end2end/tests/request_response_with_payload_legacy.c index d3b237bc340..eaa88eb91ad 100644 --- a/test/core/end2end/tests/request_response_with_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_payload_legacy.c @@ -121,7 +121,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -136,7 +136,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { cq_expect_write_accepted(v_client, tag(4), GRPC_OP_OK); cq_verify(v_client); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index 5878058c982..e5476046198 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -133,8 +133,8 @@ static void test_request_response_with_metadata_and_payload( size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -204,7 +204,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "test.google.com")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.com")); GPR_ASSERT(was_cancelled == 1); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c index f5f0e646ea9..d6554b27923 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c @@ -130,7 +130,7 @@ static void test_request_response_with_metadata_and_payload( gpr_slice_unref(request_payload_slice); gpr_slice_unref(response_payload_slice); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -149,7 +149,7 @@ static void test_request_response_with_metadata_and_payload( cq_expect_write_accepted(v_client, tag(4), GRPC_OP_OK); cq_verify(v_client); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, "key1", "val1", "key2", "val2", NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c index 7e7bec0160c..eb6180c399f 100644 --- a/test/core/end2end/tests/request_with_large_metadata.c +++ b/test/core/end2end/tests/request_with_large_metadata.c @@ -127,8 +127,8 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { int was_cancelled = 2; const int large_size = 64 * 1024; - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); meta.key = "key"; @@ -196,7 +196,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "test.google.com")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.com")); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key", meta.value)); diff --git a/test/core/end2end/tests/request_with_large_metadata_legacy.c b/test/core/end2end/tests/request_with_large_metadata_legacy.c index 560df5c4ab0..d768f148efe 100644 --- a/test/core/end2end/tests/request_with_large_metadata_legacy.c +++ b/test/core/end2end/tests/request_with_large_metadata_legacy.c @@ -121,7 +121,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { ((char*)meta.value)[large_size] = 0; meta.value_length = large_size; - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -131,7 +131,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke_old(c, f.client_cq, tag(2), tag(3), 0)); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, "key", meta.value, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 2c23f37e0c3..2bf0fa3717f 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -125,8 +125,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -187,7 +187,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "test.google.com")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.com")); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); diff --git a/test/core/end2end/tests/request_with_payload_legacy.c b/test/core/end2end/tests/request_with_payload_legacy.c index 5cda853aa9f..8d932afb35c 100644 --- a/test/core/end2end/tests/request_with_payload_legacy.c +++ b/test/core/end2end/tests/request_with_payload_legacy.c @@ -116,7 +116,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { /* byte buffer holds the slice, we can unref it already */ gpr_slice_unref(payload_slice); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -132,7 +132,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { cq_expect_write_accepted(v_client, tag(4), GRPC_OP_OK); cq_verify(v_client); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 99d1a263864..80763fe6cd8 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -113,8 +113,8 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, config.init_client(f, client_args); - c = grpc_channel_create_call(f->client, f->client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f->client, f->client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -171,7 +171,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "test.google.com")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.com")); GPR_ASSERT(was_cancelled == 0); gpr_free(details); diff --git a/test/core/end2end/tests/simple_delayed_request_legacy.c b/test/core/end2end/tests/simple_delayed_request_legacy.c index a982bb5e1b5..6b211ecccf8 100644 --- a/test/core/end2end/tests/simple_delayed_request_legacy.c +++ b/test/core/end2end/tests/simple_delayed_request_legacy.c @@ -103,7 +103,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, config.init_client(f, client_args); - c = grpc_channel_create_call_old(f->client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f->client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -119,7 +119,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f->server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 0f046ae2d23..968be74cfb9 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -121,8 +121,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) { size_t details_capacity = 0; int was_cancelled = 2; - c = grpc_channel_create_call(f.client, f.client_cq, "/foo", "test.google.com", - deadline); + c = grpc_channel_create_call(f.client, f.client_cq, "/foo", + "foo.test.google.com", deadline); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -177,7 +177,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "test.google.com")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.com")); GPR_ASSERT(was_cancelled == 0); gpr_free(details); diff --git a/test/core/end2end/tests/simple_request_legacy.c b/test/core/end2end/tests/simple_request_legacy.c index db0d6d81605..eb984cee978 100644 --- a/test/core/end2end/tests/simple_request_legacy.c +++ b/test/core/end2end/tests/simple_request_legacy.c @@ -110,7 +110,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -122,7 +122,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); @@ -157,7 +157,7 @@ static void simple_request_body2(grpc_end2end_test_fixture f) { cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -169,7 +169,7 @@ static void simple_request_body2(grpc_end2end_test_fixture f) { cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "foo.test.google.com", deadline, NULL); cq_verify(v_server); diff --git a/test/core/end2end/tests/thread_stress.c b/test/core/end2end/tests/thread_stress.c index e950a984ce8..8a5cdc7e92b 100644 --- a/test/core/end2end/tests/thread_stress.c +++ b/test/core/end2end/tests/thread_stress.c @@ -109,7 +109,7 @@ static void start_request(void) { gpr_slice slice = gpr_slice_malloc(100); grpc_byte_buffer *buf; grpc_call *call = grpc_channel_create_call_old( - g_fixture.client, "/Foo", "test.google.com", g_test_end_time); + g_fixture.client, "/Foo", "foo.test.google.com", g_test_end_time); memset(GPR_SLICE_START_PTR(slice), 1, GPR_SLICE_LENGTH(slice)); buf = grpc_byte_buffer_create(&slice, 1); diff --git a/test/core/end2end/tests/thread_stress_legacy.c b/test/core/end2end/tests/thread_stress_legacy.c index e950a984ce8..8a5cdc7e92b 100644 --- a/test/core/end2end/tests/thread_stress_legacy.c +++ b/test/core/end2end/tests/thread_stress_legacy.c @@ -109,7 +109,7 @@ static void start_request(void) { gpr_slice slice = gpr_slice_malloc(100); grpc_byte_buffer *buf; grpc_call *call = grpc_channel_create_call_old( - g_fixture.client, "/Foo", "test.google.com", g_test_end_time); + g_fixture.client, "/Foo", "foo.test.google.com", g_test_end_time); memset(GPR_SLICE_START_PTR(slice), 1, GPR_SLICE_LENGTH(slice)); buf = grpc_byte_buffer_create(&slice, 1); diff --git a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c index 0c77aa2b4ee..e7b7da17569 100644 --- a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c +++ b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c @@ -124,7 +124,7 @@ static void test_writes_done_hangs_with_pending_read( gpr_slice_unref(request_payload_slice); gpr_slice_unref(response_payload_slice); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -140,8 +140,8 @@ static void test_writes_done_hangs_with_pending_read( cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == diff --git a/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c b/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c index 0c77aa2b4ee..e7b7da17569 100644 --- a/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c +++ b/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c @@ -124,7 +124,7 @@ static void test_writes_done_hangs_with_pending_read( gpr_slice_unref(request_payload_slice); gpr_slice_unref(response_payload_slice); - c = grpc_channel_create_call_old(f.client, "/foo", "test.google.com", + c = grpc_channel_create_call_old(f.client, "/foo", "foo.test.google.com", deadline); GPR_ASSERT(c); @@ -140,8 +140,8 @@ static void test_writes_done_hangs_with_pending_read( cq_verify(v_client); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call_old(f.server, tag(100))); - cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com", - deadline, NULL); + cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", + "foo.test.google.com", deadline, NULL); cq_verify(v_server); GPR_ASSERT(GRPC_CALL_OK == From ae479218953daeca19cfe73afd0dc5f20e2721cd Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Tue, 10 Feb 2015 15:04:34 -0800 Subject: [PATCH 03/36] Update grpc_java_base Dockerfile to proto3 Proto3 is now required for Java, so build it including the Java runtime since it is not on Maven. --- tools/dockerfile/grpc_java_base/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/dockerfile/grpc_java_base/Dockerfile b/tools/dockerfile/grpc_java_base/Dockerfile index 73382ed8c9e..5dbd781f7be 100644 --- a/tools/dockerfile/grpc_java_base/Dockerfile +++ b/tools/dockerfile/grpc_java_base/Dockerfile @@ -22,11 +22,13 @@ ENV PATH $PATH:$JAVA_HOME/bin:$M2_HOME/bin ENV LD_LIBRARY_PATH /usr/local/lib # Get the protobuf source from GitHub and install it -RUN wget -O - https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.bz2 | \ - tar xj && \ - cd protobuf-2.6.1 && \ +RUN wget -O - https://github.com/google/protobuf/archive/master.tar.gz | \ + tar xz && \ + cd protobuf-master && \ + ./autogen.sh && \ ./configure --prefix=/usr && \ make -j12 && make check && make install && \ + cd java && mvn install && cd .. && \ rm -r "$(pwd)" # Install a GitHub SSH service credential that gives access to the GitHub repo while it's private From baced4def008b3b03f89eef3f9d6da34e38b5f2a Mon Sep 17 00:00:00 2001 From: David Klempner Date: Tue, 10 Feb 2015 17:10:15 -0800 Subject: [PATCH 04/36] Epoll based multipoller This is a multipoller based on epoll rather than poll. Note that this implementation is aimed at correctness rather than performance, although it should immediately have better scalability to large numbers of FDs, both due to epoll's O(1) sized API and due to not needing to wake up polling threads to do interest set changes. One notable difference here is that we directly attach a wakeup fd rather than using the freelisting kick mechanism that the poll() based implementations use, because modifying the epoll set to use a different kick fd each time isn't free. --- Makefile | 5 + build.json | 1 + include/grpc/support/port_platform.h | 2 +- .../iomgr/pollset_multipoller_with_epoll.c | 199 ++++++++++++++++++ .../pollset_multipoller_with_poll_posix.c | 6 +- src/core/iomgr/pollset_posix.c | 11 +- src/core/iomgr/pollset_posix.h | 1 + test/core/iomgr/tcp_client_posix_test.c | 1 + vsprojects/vs2013/grpc.vcxproj | 2 + vsprojects/vs2013/grpc.vcxproj.filters | 3 + vsprojects/vs2013/grpc_unsecure.vcxproj | 2 + .../vs2013/grpc_unsecure.vcxproj.filters | 3 + 12 files changed, 231 insertions(+), 5 deletions(-) create mode 100644 src/core/iomgr/pollset_multipoller_with_epoll.c diff --git a/Makefile b/Makefile index c411c07e425..8e0d649288d 100644 --- a/Makefile +++ b/Makefile @@ -1889,6 +1889,7 @@ LIBGRPC_SRC = \ src/core/iomgr/iomgr_posix.c \ src/core/iomgr/pollset_kick.c \ src/core/iomgr/pollset_multipoller_with_poll_posix.c \ + src/core/iomgr/pollset_multipoller_with_epoll.c \ src/core/iomgr/pollset_posix.c \ src/core/iomgr/pollset_windows.c \ src/core/iomgr/resolve_address.c \ @@ -2018,6 +2019,7 @@ src/core/iomgr/iomgr.c: $(OPENSSL_DEP) src/core/iomgr/iomgr_posix.c: $(OPENSSL_DEP) src/core/iomgr/pollset_kick.c: $(OPENSSL_DEP) src/core/iomgr/pollset_multipoller_with_poll_posix.c: $(OPENSSL_DEP) +src/core/iomgr/pollset_multipoller_with_epoll.c: $(OPENSSL_DEP) src/core/iomgr/pollset_posix.c: $(OPENSSL_DEP) src/core/iomgr/pollset_windows.c: $(OPENSSL_DEP) src/core/iomgr/resolve_address.c: $(OPENSSL_DEP) @@ -2169,6 +2171,7 @@ objs/$(CONFIG)/src/core/iomgr/iomgr.o: objs/$(CONFIG)/src/core/iomgr/iomgr_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_kick.o: objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_poll_posix.o: +objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_epoll.o: objs/$(CONFIG)/src/core/iomgr/pollset_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_windows.o: objs/$(CONFIG)/src/core/iomgr/resolve_address.o: @@ -2404,6 +2407,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/iomgr/iomgr_posix.c \ src/core/iomgr/pollset_kick.c \ src/core/iomgr/pollset_multipoller_with_poll_posix.c \ + src/core/iomgr/pollset_multipoller_with_epoll.c \ src/core/iomgr/pollset_posix.c \ src/core/iomgr/pollset_windows.c \ src/core/iomgr/resolve_address.c \ @@ -2538,6 +2542,7 @@ objs/$(CONFIG)/src/core/iomgr/iomgr.o: objs/$(CONFIG)/src/core/iomgr/iomgr_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_kick.o: objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_poll_posix.o: +objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_epoll.o: objs/$(CONFIG)/src/core/iomgr/pollset_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_windows.o: objs/$(CONFIG)/src/core/iomgr/resolve_address.o: diff --git a/build.json b/build.json index c9a83f56c17..2681cf5064c 100644 --- a/build.json +++ b/build.json @@ -134,6 +134,7 @@ "src/core/iomgr/iomgr_posix.c", "src/core/iomgr/pollset_kick.c", "src/core/iomgr/pollset_multipoller_with_poll_posix.c", + "src/core/iomgr/pollset_multipoller_with_epoll.c", "src/core/iomgr/pollset_posix.c", "src/core/iomgr/pollset_windows.c", "src/core/iomgr/resolve_address.c", diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index e99099c651c..69a2f9c6840 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -71,7 +71,7 @@ #define GPR_CPU_LINUX 1 #define GPR_GCC_ATOMIC 1 #define GPR_LINUX 1 -#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 +#define GPR_POSIX_MULTIPOLL_WITH_EPOLL 1 #define GPR_POSIX_WAKEUP_FD 1 #define GPR_LINUX_EVENTFD 1 #define GPR_POSIX_SOCKET 1 diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c new file mode 100644 index 00000000000..14c038e7afa --- /dev/null +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -0,0 +1,199 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifdef GPR_POSIX_MULTIPOLL_WITH_EPOLL + +#include +#include +#include + +#include "src/core/iomgr/fd_posix.h" +#include +#include + +typedef struct { + int epoll_fd; + grpc_wakeup_fd_info wakeup_fd; +} pollset_hdr; + +static void multipoll_with_epoll_pollset_add_fd(grpc_pollset *pollset, + grpc_fd *fd) { + pollset_hdr *h = pollset->data.ptr; + struct epoll_event ev; + int err; + + ev.events = EPOLLIN | EPOLLOUT | EPOLLET; + ev.data.ptr = fd; + err = epoll_ctl(h->epoll_fd, EPOLL_CTL_ADD, fd->fd, &ev); + if (err < 0) { + /* FDs may be added to a pollset multiple times, so EEXIST is normal. */ + if (errno != EEXIST) { + gpr_log(GPR_ERROR, "epoll_ctl add for %d failed: %s", fd->fd, + strerror(errno)); + } + } +} + +static void multipoll_with_epoll_pollset_del_fd(grpc_pollset *pollset, + grpc_fd *fd) { + pollset_hdr *h = pollset->data.ptr; + int err; + /* Note that this can race with concurrent poll, but that should be fine since + * at worst it creates a spurious read event on a reused grpc_fd object. */ + err = epoll_ctl(h->epoll_fd, EPOLL_CTL_DEL, fd->fd, NULL); + if (err < 0) { + gpr_log(GPR_ERROR, "epoll_ctl del for %d failed: %s", fd->fd, + strerror(errno)); + } +} + +/* TODO(klempner): We probably want to turn this down a bit */ +#define GRPC_EPOLL_MAX_EVENTS 1000 + +static int multipoll_with_epoll_pollset_maybe_work( + grpc_pollset *pollset, gpr_timespec deadline, gpr_timespec now, + int allow_synchronous_callback) { + struct epoll_event ep_ev[GRPC_EPOLL_MAX_EVENTS]; + int ep_rv; + pollset_hdr *h = pollset->data.ptr; + int timeout_ms; + + /* If you want to ignore epoll's ability to sanely handle parallel pollers, + * for a more apples-to-apples performance comparison with poll, add a + * if (pollset->counter == 0) { return 0 } + * here. + */ + + if (gpr_time_cmp(deadline, gpr_inf_future) == 0) { + timeout_ms = -1; + } else { + timeout_ms = gpr_time_to_millis(gpr_time_sub(deadline, now)); + if (timeout_ms <= 0) { + return 1; + } + } + pollset->counter += 1; + gpr_mu_unlock(&pollset->mu); + + do { + ep_rv = epoll_wait(h->epoll_fd, ep_ev, GRPC_EPOLL_MAX_EVENTS, timeout_ms); + if (ep_rv < 0) { + if (errno != EINTR) { + gpr_log(GPR_ERROR, "epoll_wait() failed: %s", strerror(errno)); + } + } else { + int i; + for (i = 0; i < ep_rv; ++i) { + if (ep_ev[i].data.ptr == 0) { + grpc_wakeup_fd_consume_wakeup(&h->wakeup_fd); + } else { + grpc_fd *fd = ep_ev[i].data.ptr; + /* TODO(klempner): We might want to consider making err and pri + * separate events */ + int cancel = ep_ev[i].events & (EPOLLERR | EPOLLHUP); + int read = ep_ev[i].events & (EPOLLIN | EPOLLPRI); + int write = ep_ev[i].events & EPOLLOUT; + if (read || cancel) { + grpc_fd_become_readable(fd, allow_synchronous_callback); + } + if (write || cancel) { + grpc_fd_become_writable(fd, allow_synchronous_callback); + } + } + } + } + timeout_ms = 0; + } while (ep_rv == GRPC_EPOLL_MAX_EVENTS); + + gpr_mu_lock(&pollset->mu); + pollset->counter -= 1; + /* TODO(klempner): This should be a signal and not a broadcast, althoughit + * probably doesn't matter because */ + gpr_cv_broadcast(&pollset->cv); + return 1; +} + +static void multipoll_with_epoll_pollset_destroy(grpc_pollset *pollset) { + pollset_hdr *h = pollset->data.ptr; + gpr_free(h); +} + +static void epoll_kick(grpc_pollset *pollset) { + pollset_hdr *h = pollset->data.ptr; + grpc_wakeup_fd_wakeup(&h->wakeup_fd); +} + +static const grpc_pollset_vtable multipoll_with_epoll_pollset = { + multipoll_with_epoll_pollset_add_fd, multipoll_with_epoll_pollset_del_fd, + multipoll_with_epoll_pollset_maybe_work, epoll_kick, + multipoll_with_epoll_pollset_destroy}; + +void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, + size_t nfds) { + size_t i; + pollset_hdr *h = gpr_malloc(sizeof(pollset_hdr)); + struct epoll_event ev; + int err; + + pollset->vtable = &multipoll_with_epoll_pollset; + pollset->data.ptr = h; + h->epoll_fd = epoll_create1(EPOLL_CLOEXEC); + if (h->epoll_fd < 0) { + /* TODO(klempner): Fall back to poll here, especially on ENOSYS */ + gpr_log(GPR_ERROR, "epoll_create1 failed: %s", strerror(errno)); + abort(); + } + for (i = 0; i < nfds; i++) { + if (grpc_fd_is_orphaned(fds[i])) { + /* This should not happen, remove before merging upstream because this is + * better fixed in unary poller */ + grpc_fd_unref(fds[i]); + } else { + multipoll_with_epoll_pollset_add_fd(pollset, fds[i]); + } + } + + grpc_wakeup_fd_create(&h->wakeup_fd); + ev.events = EPOLLIN; + ev.data.ptr = 0; + err = epoll_ctl(h->epoll_fd, EPOLL_CTL_ADD, + GRPC_WAKEUP_FD_GET_READ_FD(&h->wakeup_fd), &ev); + if (err < 0) { + gpr_log(GPR_ERROR, "Wakeup fd epoll_ctl failed: %s", strerror(errno)); + abort(); + } +} + +#endif /* GPR_POSIX_MULTIPOLL_WITH_EPOLL */ diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c index 3244ae08db5..c136ee0b528 100644 --- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c +++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c @@ -200,6 +200,10 @@ static int multipoll_with_poll_pollset_maybe_work( return 1; } +static void multipoll_with_poll_pollset_kick(grpc_pollset *p) { + grpc_pollset_kick_kick(&p->kick_state); +} + static void multipoll_with_poll_pollset_destroy(grpc_pollset *pollset) { size_t i; pollset_hdr *h = pollset->data.ptr; @@ -219,7 +223,7 @@ static void multipoll_with_poll_pollset_destroy(grpc_pollset *pollset) { static const grpc_pollset_vtable multipoll_with_poll_pollset = { multipoll_with_poll_pollset_add_fd, multipoll_with_poll_pollset_del_fd, - multipoll_with_poll_pollset_maybe_work, + multipoll_with_poll_pollset_maybe_work, multipoll_with_poll_pollset_kick, multipoll_with_poll_pollset_destroy}; void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index b0404b870b5..ceedfbd51fc 100644 --- a/src/core/iomgr/pollset_posix.c +++ b/src/core/iomgr/pollset_posix.c @@ -76,7 +76,7 @@ static void backup_poller(void *p) { void grpc_pollset_kick(grpc_pollset *p) { if (p->counter) { - grpc_pollset_kick_kick(&p->kick_state); + p->vtable->kick(p); } } @@ -84,6 +84,10 @@ void grpc_pollset_force_kick(grpc_pollset *p) { grpc_pollset_kick_kick(&p->kick_state); } +static void kick_using_pollset_kick(grpc_pollset *p) { + grpc_pollset_kick_kick(&p->kick_state); +} + /* global state management */ grpc_pollset *grpc_backup_pollset(void) { return &g_backup_pollset; } @@ -186,7 +190,7 @@ static void empty_pollset_destroy(grpc_pollset *pollset) {} static const grpc_pollset_vtable empty_pollset = { empty_pollset_add_fd, empty_pollset_del_fd, empty_pollset_maybe_work, - empty_pollset_destroy}; + kick_using_pollset_kick, empty_pollset_destroy}; static void become_empty_pollset(grpc_pollset *pollset) { pollset->vtable = &empty_pollset; @@ -289,7 +293,8 @@ static void unary_poll_pollset_destroy(grpc_pollset *pollset) { static const grpc_pollset_vtable unary_poll_pollset = { unary_poll_pollset_add_fd, unary_poll_pollset_del_fd, - unary_poll_pollset_maybe_work, unary_poll_pollset_destroy}; + unary_poll_pollset_maybe_work, kick_using_pollset_kick, + unary_poll_pollset_destroy}; static void become_unary_pollset(grpc_pollset *pollset, grpc_fd *fd) { pollset->vtable = &unary_poll_pollset; diff --git a/src/core/iomgr/pollset_posix.h b/src/core/iomgr/pollset_posix.h index cdcb9951675..b1a82fccfe7 100644 --- a/src/core/iomgr/pollset_posix.h +++ b/src/core/iomgr/pollset_posix.h @@ -66,6 +66,7 @@ struct grpc_pollset_vtable { void (*del_fd)(grpc_pollset *pollset, struct grpc_fd *fd); int (*maybe_work)(grpc_pollset *pollset, gpr_timespec deadline, gpr_timespec now, int allow_synchronous_callback); + void (*kick)(grpc_pollset *pollset); void (*destroy)(grpc_pollset *pollset); }; diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c index 00b10f93648..78709f47fbc 100644 --- a/test/core/iomgr/tcp_client_posix_test.c +++ b/test/core/iomgr/tcp_client_posix_test.c @@ -171,6 +171,7 @@ void test_times_out(void) { int main(void) { grpc_iomgr_init(); test_succeeds(); + gpr_log(GPR_ERROR, "End of first test"); test_fails(); test_times_out(); grpc_iomgr_shutdown(); diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index c6f2846e317..0050d8cec3b 100644 --- a/vsprojects/vs2013/grpc.vcxproj +++ b/vsprojects/vs2013/grpc.vcxproj @@ -261,6 +261,8 @@ + + diff --git a/vsprojects/vs2013/grpc.vcxproj.filters b/vsprojects/vs2013/grpc.vcxproj.filters index ce76dd8d2b9..26b4aadf147 100644 --- a/vsprojects/vs2013/grpc.vcxproj.filters +++ b/vsprojects/vs2013/grpc.vcxproj.filters @@ -124,6 +124,9 @@ src\core\iomgr + + src\core\iomgr + src\core\iomgr diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index c6f2846e317..0050d8cec3b 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -261,6 +261,8 @@ + + diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters index 0e942219d07..80525445f27 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters @@ -85,6 +85,9 @@ src\core\iomgr + + src\core\iomgr + src\core\iomgr From 9e1d446ff30e069a7f1823c086756d7088b51357 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 10:20:55 -0800 Subject: [PATCH 05/36] some VS project template fixes and added templates for grpc_csharp_ext --- build.json | 3 +- .../vs2013/gpr.vcxproj.filters.template | 4 +- .../vs2013/grpc.vcxproj.filters.template | 4 +- .../grpc_csharp_ext.vcxproj.filters.template | 2 + .../vs2013/grpc_csharp_ext.vcxproj.template | 2 + .../grpc_unsecure.vcxproj.filters.template | 4 +- .../vs2013/grpc_unsecure.vcxproj.template | 2 +- .../vs2013/vcxproj.filters_defs.include | 2 +- vsprojects/vs2013/grpc.sln | 10 ++ vsprojects/vs2013/grpc_csharp_ext.vcxproj | 91 +++++++++++++++++++ .../vs2013/grpc_csharp_ext.vcxproj.filters | 1 + vsprojects/vs2013/grpc_unsecure.vcxproj | 40 +------- 12 files changed, 117 insertions(+), 48 deletions(-) create mode 100644 templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template create mode 100644 templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.template create mode 100644 vsprojects/vs2013/grpc_csharp_ext.vcxproj create mode 100644 vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters diff --git a/build.json b/build.json index c9a83f56c17..df51a62687d 100644 --- a/build.json +++ b/build.json @@ -337,7 +337,8 @@ "deps": [ "gpr", "grpc" - ] + ], + "vs_project_guid": "{D64C6D63-4458-4A88-AB38-35678384A7E4}" }, { "name": "grpc_test_util", diff --git a/templates/vsprojects/vs2013/gpr.vcxproj.filters.template b/templates/vsprojects/vs2013/gpr.vcxproj.filters.template index 0ed1ed85d0d..c8b2ce099ea 100644 --- a/templates/vsprojects/vs2013/gpr.vcxproj.filters.template +++ b/templates/vsprojects/vs2013/gpr.vcxproj.filters.template @@ -1,2 +1,2 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_project"/>\ -${gen_project('gpr', libs, targets)} +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('gpr', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc.vcxproj.filters.template index 0327c9422d9..b8e91bd61c4 100644 --- a/templates/vsprojects/vs2013/grpc.vcxproj.filters.template +++ b/templates/vsprojects/vs2013/grpc.vcxproj.filters.template @@ -1,2 +1,2 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_project"/>\ -${gen_project('grpc', libs, targets)} +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template new file mode 100644 index 00000000000..2b2fc8fadd7 --- /dev/null +++ b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grc_csharp_ext', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.template b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.template new file mode 100644 index 00000000000..84aa50209aa --- /dev/null +++ b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc_csharp_ext', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.filters.template index 48cbbd30bb6..ef918922ef7 100644 --- a/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.filters.template +++ b/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.filters.template @@ -1,2 +1,2 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_project"/>\ -${gen_project('grpc_unsecure', libs, targets)} +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc_unsecure', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.template b/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.template index 3de6453f520..4f62b85a856 100644 --- a/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.template +++ b/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc', libs, targets)} \ No newline at end of file +${gen_project('grpc_unsecure', libs, targets)} \ No newline at end of file diff --git a/templates/vsprojects/vs2013/vcxproj.filters_defs.include b/templates/vsprojects/vs2013/vcxproj.filters_defs.include index c25718b8025..539ae932f14 100644 --- a/templates/vsprojects/vs2013/vcxproj.filters_defs.include +++ b/templates/vsprojects/vs2013/vcxproj.filters_defs.include @@ -8,7 +8,7 @@ <%def name="to_windows_path(path)">${path.replace('/','\\')}\ <%def name="to_filter(path)">${calc_to_filter(path)}\ <%def name="filter_to_guid(proj, filter)">${re.sub('(........)(....)(....)(....)', r'\1-\2-\3-\4-', hashlib.md5(''.join([filter, proj])).hexdigest())}\ -<%def name="gen_project(name, libs, targets)">\ +<%def name="gen_filters(name, libs, targets)">\ % for project in vsprojects: % if project.name == name: diff --git a/vsprojects/vs2013/grpc.sln b/vsprojects/vs2013/grpc.sln index 9b3ebaf633b..efc4725ed18 100644 --- a/vsprojects/vs2013/grpc.sln +++ b/vsprojects/vs2013/grpc.sln @@ -12,6 +12,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc", "grpc.vcxproj", "{29 {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext", "grpc_csharp_ext.vcxproj", "{D64C6D63-4458-4A88-AB38-35678384A7E4}" + ProjectSection(ProjectDependencies) = postProject + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_test_util", "grpc_test_util.vcxproj", "{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_unsecure", "grpc_unsecure.vcxproj", "{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}" @@ -41,6 +47,10 @@ Global {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Debug|Win32.Build.0 = Debug|Win32 {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Release|Win32.ActiveCfg = Release|Win32 {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Release|Win32.Build.0 = Release|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Debug|Win32.ActiveCfg = Debug|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Debug|Win32.Build.0 = Debug|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Release|Win32.ActiveCfg = Release|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Release|Win32.Build.0 = Release|Win32 {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Debug|Win32.ActiveCfg = Debug|Win32 {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Debug|Win32.Build.0 = Debug|Win32 {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vs2013/grpc_csharp_ext.vcxproj b/vsprojects/vs2013/grpc_csharp_ext.vcxproj new file mode 100644 index 00000000000..0f355661869 --- /dev/null +++ b/vsprojects/vs2013/grpc_csharp_ext.vcxproj @@ -0,0 +1,91 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {D64C6D63-4458-4A88-AB38-35678384A7E4} + + + + StaticLibrary + true + v120 + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + v120 + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + + + + diff --git a/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters b/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters @@ -0,0 +1 @@ + diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index c6f2846e317..41c24ff33e7 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -11,7 +11,7 @@ - {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {46CEDFFF-9692-456A-AA24-38B5D6BCF4C5} @@ -73,24 +73,12 @@ - - - - - - - - - - - - @@ -179,32 +167,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - From 3b2277490d50445ac36dd22e7e0499a10abded18 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 10:36:01 -0800 Subject: [PATCH 06/36] added user settings and generated files to gitignore --- vsprojects/vs2013/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vsprojects/vs2013/.gitignore b/vsprojects/vs2013/.gitignore index 75fb4ed6b6f..304acf019cd 100644 --- a/vsprojects/vs2013/.gitignore +++ b/vsprojects/vs2013/.gitignore @@ -1,5 +1,8 @@ Debug Release *.suo +*.user +test_bin grpc.opensdf grpc.sdf +third_party/*.user From 92e2e3f55eb9985e720c669fe514b4ebea5219b1 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 10:20:55 -0800 Subject: [PATCH 07/36] some VS project template fixes and added templates for grpc_csharp_ext --- build.json | 3 +- .../vs2013/gpr.vcxproj.filters.template | 4 +- .../vs2013/grpc.vcxproj.filters.template | 4 +- .../grpc_csharp_ext.vcxproj.filters.template | 2 + .../vs2013/grpc_csharp_ext.vcxproj.template | 2 + .../grpc_unsecure.vcxproj.filters.template | 4 +- .../vs2013/grpc_unsecure.vcxproj.template | 2 +- .../vs2013/vcxproj.filters_defs.include | 2 +- vsprojects/vs2013/grpc.sln | 10 ++ vsprojects/vs2013/grpc_csharp_ext.vcxproj | 91 +++++++++++++++++++ .../vs2013/grpc_csharp_ext.vcxproj.filters | 1 + vsprojects/vs2013/grpc_unsecure.vcxproj | 40 +------- 12 files changed, 117 insertions(+), 48 deletions(-) create mode 100644 templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template create mode 100644 templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.template create mode 100644 vsprojects/vs2013/grpc_csharp_ext.vcxproj create mode 100644 vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters diff --git a/build.json b/build.json index 22a404503ef..bbff314aa26 100644 --- a/build.json +++ b/build.json @@ -347,7 +347,8 @@ "deps": [ "gpr", "grpc" - ] + ], + "vs_project_guid": "{D64C6D63-4458-4A88-AB38-35678384A7E4}" }, { "name": "grpc_test_util", diff --git a/templates/vsprojects/vs2013/gpr.vcxproj.filters.template b/templates/vsprojects/vs2013/gpr.vcxproj.filters.template index 0ed1ed85d0d..c8b2ce099ea 100644 --- a/templates/vsprojects/vs2013/gpr.vcxproj.filters.template +++ b/templates/vsprojects/vs2013/gpr.vcxproj.filters.template @@ -1,2 +1,2 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_project"/>\ -${gen_project('gpr', libs, targets)} +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('gpr', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc.vcxproj.filters.template index 0327c9422d9..b8e91bd61c4 100644 --- a/templates/vsprojects/vs2013/grpc.vcxproj.filters.template +++ b/templates/vsprojects/vs2013/grpc.vcxproj.filters.template @@ -1,2 +1,2 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_project"/>\ -${gen_project('grpc', libs, targets)} +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template new file mode 100644 index 00000000000..2b2fc8fadd7 --- /dev/null +++ b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grc_csharp_ext', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.template b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.template new file mode 100644 index 00000000000..84aa50209aa --- /dev/null +++ b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc_csharp_ext', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.filters.template index 48cbbd30bb6..ef918922ef7 100644 --- a/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.filters.template +++ b/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.filters.template @@ -1,2 +1,2 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_project"/>\ -${gen_project('grpc_unsecure', libs, targets)} +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc_unsecure', libs, targets)} diff --git a/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.template b/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.template index 3de6453f520..4f62b85a856 100644 --- a/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.template +++ b/templates/vsprojects/vs2013/grpc_unsecure.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc', libs, targets)} \ No newline at end of file +${gen_project('grpc_unsecure', libs, targets)} \ No newline at end of file diff --git a/templates/vsprojects/vs2013/vcxproj.filters_defs.include b/templates/vsprojects/vs2013/vcxproj.filters_defs.include index c25718b8025..539ae932f14 100644 --- a/templates/vsprojects/vs2013/vcxproj.filters_defs.include +++ b/templates/vsprojects/vs2013/vcxproj.filters_defs.include @@ -8,7 +8,7 @@ <%def name="to_windows_path(path)">${path.replace('/','\\')}\ <%def name="to_filter(path)">${calc_to_filter(path)}\ <%def name="filter_to_guid(proj, filter)">${re.sub('(........)(....)(....)(....)', r'\1-\2-\3-\4-', hashlib.md5(''.join([filter, proj])).hexdigest())}\ -<%def name="gen_project(name, libs, targets)">\ +<%def name="gen_filters(name, libs, targets)">\ % for project in vsprojects: % if project.name == name: diff --git a/vsprojects/vs2013/grpc.sln b/vsprojects/vs2013/grpc.sln index 9b3ebaf633b..efc4725ed18 100644 --- a/vsprojects/vs2013/grpc.sln +++ b/vsprojects/vs2013/grpc.sln @@ -12,6 +12,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc", "grpc.vcxproj", "{29 {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext", "grpc_csharp_ext.vcxproj", "{D64C6D63-4458-4A88-AB38-35678384A7E4}" + ProjectSection(ProjectDependencies) = postProject + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_test_util", "grpc_test_util.vcxproj", "{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_unsecure", "grpc_unsecure.vcxproj", "{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}" @@ -41,6 +47,10 @@ Global {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Debug|Win32.Build.0 = Debug|Win32 {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Release|Win32.ActiveCfg = Release|Win32 {29D16885-7228-4C31-81ED-5F9187C7F2A9}.Release|Win32.Build.0 = Release|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Debug|Win32.ActiveCfg = Debug|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Debug|Win32.Build.0 = Debug|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Release|Win32.ActiveCfg = Release|Win32 + {D64C6D63-4458-4A88-AB38-35678384A7E4}.Release|Win32.Build.0 = Release|Win32 {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Debug|Win32.ActiveCfg = Debug|Win32 {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Debug|Win32.Build.0 = Debug|Win32 {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vs2013/grpc_csharp_ext.vcxproj b/vsprojects/vs2013/grpc_csharp_ext.vcxproj new file mode 100644 index 00000000000..0f355661869 --- /dev/null +++ b/vsprojects/vs2013/grpc_csharp_ext.vcxproj @@ -0,0 +1,91 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {D64C6D63-4458-4A88-AB38-35678384A7E4} + + + + StaticLibrary + true + v120 + Unicode + $(Configuration)\$(ProjectName)\ + + + StaticLibrary + false + v120 + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + + + + diff --git a/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters b/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters @@ -0,0 +1 @@ + diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index 12428bd4b16..3dab86c6e94 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -11,7 +11,7 @@ - {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {46CEDFFF-9692-456A-AA24-38B5D6BCF4C5} @@ -73,24 +73,12 @@ - - - - - - - - - - - - @@ -182,32 +170,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - From 326c164327b1fbdd5a63e549d273376a271fc3fa Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 10:36:01 -0800 Subject: [PATCH 08/36] added user settings and generated files to gitignore --- vsprojects/vs2013/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vsprojects/vs2013/.gitignore b/vsprojects/vs2013/.gitignore index 75fb4ed6b6f..304acf019cd 100644 --- a/vsprojects/vs2013/.gitignore +++ b/vsprojects/vs2013/.gitignore @@ -1,5 +1,8 @@ Debug Release *.suo +*.user +test_bin grpc.opensdf grpc.sdf +third_party/*.user From c8df0a85ba2f1312b8675b7864162aac68a59dc9 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Feb 2015 11:15:31 -0800 Subject: [PATCH 09/36] Added a performance test --- src/node/examples/perf_test.js | 104 +++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/node/examples/perf_test.js diff --git a/src/node/examples/perf_test.js b/src/node/examples/perf_test.js new file mode 100644 index 00000000000..379b14e000b --- /dev/null +++ b/src/node/examples/perf_test.js @@ -0,0 +1,104 @@ +/* + * + * Copyright 2014, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +var grpc = require('..'); +var testProto = grpc.load(__dirname + '/../interop/test.proto').grpc.testing; +var _ = require('underscore'); +var interop_server = require('../interop/interop_server.js'); + +function runTest(iterations, callback) { + var testServer = interop_server.getServer(0, false); + testServer.server.listen(); + var client = new testProto.TestService('localhost:' + testServer.port); + + function runIterations(finish) { + var start = process.hrtime(); + var intervals = []; + var pending = iterations; + function next(i) { + if (i >= iterations) { + testServer.server.shutdown(); + var totalDiff = process.hrtime(start); + finish({ + total: totalDiff[0] * 1000000 + totalDiff[1] / 1000, + intervals: intervals + }); + } else{ + var deadline = new Date(); + deadline.setSeconds(deadline.getSeconds() + 3); + var startTime = process.hrtime(); + client.emptyCall({}, function(err, resp) { + var timeDiff = process.hrtime(startTime); + intervals[i] = timeDiff[0] * 1000000 + timeDiff[1] / 1000; + next(i+1); + }, {}, deadline); + } + } + next(0); + } + + function warmUp(num) { + var pending = num; + for (var i = 0; i < num; i++) { + (function(i) { + client.emptyCall({}, function(err, resp) { + pending--; + if (pending === 0) { + runIterations(callback); + } + }); + })(i); + } + } + warmUp(100); +} + +if (require.main === module) { + var count; + if (process.argv.length >= 3) { + count = process.argv[2]; + } else { + count = 100; + } + runTest(count, function(results) { + console.log('count:', count); + console.log('total time:', results.total, 'us'); + console.log('min latency:', _.min(results.intervals), 'us'); + console.log('max latency:', _.max(results.intervals), 'us'); + console.log('average latency:', _.reduce(results.intervals, function(a, b){ + return a+b; + }) / count, 'us'); + }); +} + +module.exports = runTest; From 909bfaea41ddfd44e6d96a3fff57495b7b7b9a06 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Feb 2015 11:17:10 -0800 Subject: [PATCH 10/36] Updated copyright date --- src/node/examples/perf_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/examples/perf_test.js b/src/node/examples/perf_test.js index 379b14e000b..7da600c6155 100644 --- a/src/node/examples/perf_test.js +++ b/src/node/examples/perf_test.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without From 2fe2ec6736b19df8b278085ac1a19c787be50887 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 11 Feb 2015 12:28:34 -0800 Subject: [PATCH 11/36] Added standard performance metrics --- src/node/examples/perf_test.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/node/examples/perf_test.js b/src/node/examples/perf_test.js index 7da600c6155..c5e28727369 100644 --- a/src/node/examples/perf_test.js +++ b/src/node/examples/perf_test.js @@ -83,6 +83,16 @@ function runTest(iterations, callback) { warmUp(100); } +function percentile(arr, percentile) { + if (percentile > 99) { + percentile = 99; + } + if (percentile < 0) { + percentile = 0; + } + return arr[(arr.length * percentile / 100)|0]; +} + if (require.main === module) { var count; if (process.argv.length >= 3) { @@ -91,13 +101,14 @@ if (require.main === module) { count = 100; } runTest(count, function(results) { + var sorted_intervals = _.sortBy(results.intervals, _.identity); console.log('count:', count); console.log('total time:', results.total, 'us'); - console.log('min latency:', _.min(results.intervals), 'us'); - console.log('max latency:', _.max(results.intervals), 'us'); - console.log('average latency:', _.reduce(results.intervals, function(a, b){ - return a+b; - }) / count, 'us'); + console.log('median:', percentile(sorted_intervals, 50), 'us'); + console.log('90th percentile:', percentile(sorted_intervals, 90), 'us'); + console.log('95th percentile:', percentile(sorted_intervals, 95), 'us'); + console.log('99th percentile:', percentile(sorted_intervals, 99), 'us'); + console.log('QPS:', (count / results.total) * 1000000); }); } From 2dcc9a8de1cd405cb629e1a6f7fc6a35d993ad69 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 12:52:32 -0800 Subject: [PATCH 12/36] removed empty filters file for grpc_csharp_ext --- .../vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template | 2 -- vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters | 1 - 2 files changed, 3 deletions(-) delete mode 100644 templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template delete mode 100644 vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters diff --git a/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template deleted file mode 100644 index 2b2fc8fadd7..00000000000 --- a/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grc_csharp_ext', libs, targets)} diff --git a/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters b/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters deleted file mode 100644 index 8b137891791..00000000000 --- a/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters +++ /dev/null @@ -1 +0,0 @@ - From b7f53d929637c35b0313c437f5affc6adb676e0b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 12:58:01 -0800 Subject: [PATCH 13/36] removed filters for grpc_csharp_ext --- .../vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template | 2 -- vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters | 1 - 2 files changed, 3 deletions(-) delete mode 100644 templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template delete mode 100644 vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters diff --git a/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template deleted file mode 100644 index 2b2fc8fadd7..00000000000 --- a/templates/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters.template +++ /dev/null @@ -1,2 +0,0 @@ -<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grc_csharp_ext', libs, targets)} diff --git a/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters b/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters deleted file mode 100644 index 8b137891791..00000000000 --- a/vsprojects/vs2013/grpc_csharp_ext.vcxproj.filters +++ /dev/null @@ -1 +0,0 @@ - From 3a890a2290cec81b2be0a2ce7f821a95cccd43af Mon Sep 17 00:00:00 2001 From: David Klempner Date: Wed, 11 Feb 2015 13:09:50 -0800 Subject: [PATCH 14/36] Remove now unnecessary check that incoming epoll fds are not orphaned --- src/core/iomgr/pollset_multipoller_with_epoll.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c index 14c038e7afa..8171c5f1dd1 100644 --- a/src/core/iomgr/pollset_multipoller_with_epoll.c +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -176,13 +176,7 @@ void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, abort(); } for (i = 0; i < nfds; i++) { - if (grpc_fd_is_orphaned(fds[i])) { - /* This should not happen, remove before merging upstream because this is - * better fixed in unary poller */ - grpc_fd_unref(fds[i]); - } else { - multipoll_with_epoll_pollset_add_fd(pollset, fds[i]); - } + multipoll_with_epoll_pollset_add_fd(pollset, fds[i]); } grpc_wakeup_fd_create(&h->wakeup_fd); From 7c9f0919f2af1cbab0de88205179efb4ef818e3d Mon Sep 17 00:00:00 2001 From: David Klempner Date: Wed, 11 Feb 2015 13:26:18 -0800 Subject: [PATCH 15/36] Address pull request thread comments 1. Close the epoll_fd at destroy 2. Finish the comment about signal/broadcast on the cv 3. Rename GPR_POSIX_MULTIPOLL_WITH_EPOLL to GPR_LINUX_MULTIPOLL_WITH_EPOLL --- src/core/iomgr/pollset_multipoller_with_epoll.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c index 8171c5f1dd1..9044892a926 100644 --- a/src/core/iomgr/pollset_multipoller_with_epoll.c +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -33,11 +33,12 @@ #include -#ifdef GPR_POSIX_MULTIPOLL_WITH_EPOLL +#ifdef GPR_LINUX_MULTIPOLL_WITH_EPOLL #include #include #include +#include #include "src/core/iomgr/fd_posix.h" #include @@ -139,14 +140,16 @@ static int multipoll_with_epoll_pollset_maybe_work( gpr_mu_lock(&pollset->mu); pollset->counter -= 1; - /* TODO(klempner): This should be a signal and not a broadcast, althoughit - * probably doesn't matter because */ + /* TODO(klempner): This should signal once per event rather than broadcast, + * although it probably doesn't matter because threads will generally be + * blocked in epoll_wait rather than being blocked on the cv. */ gpr_cv_broadcast(&pollset->cv); return 1; } static void multipoll_with_epoll_pollset_destroy(grpc_pollset *pollset) { pollset_hdr *h = pollset->data.ptr; + close(h->epoll_fd); gpr_free(h); } @@ -190,4 +193,4 @@ void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, } } -#endif /* GPR_POSIX_MULTIPOLL_WITH_EPOLL */ +#endif /* GPR_LINUX_MULTIPOLL_WITH_EPOLL */ From fdd42cfa4e02208e3767851735357d1969358afb Mon Sep 17 00:00:00 2001 From: David Klempner Date: Wed, 11 Feb 2015 13:34:04 -0800 Subject: [PATCH 16/36] Actually include the port_platform.h epoll change too --- include/grpc/support/port_platform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 68c827ad849..9d4bfbee5e8 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -73,7 +73,7 @@ #define GPR_CPU_LINUX 1 #define GPR_GCC_ATOMIC 1 #define GPR_LINUX 1 -#define GPR_POSIX_MULTIPOLL_WITH_EPOLL 1 +#define GPR_LINUX_MULTIPOLL_WITH_EPOLL 1 #define GPR_POSIX_WAKEUP_FD 1 #define GPR_LINUX_EVENTFD 1 #define GPR_POSIX_SOCKET 1 From a10abbdbec8032b4641a59bdeeb75a1d320a0e0e Mon Sep 17 00:00:00 2001 From: David Klempner Date: Wed, 11 Feb 2015 13:49:05 -0800 Subject: [PATCH 17/36] Clean up the epoll wakeup fd too. --- src/core/iomgr/pollset_multipoller_with_epoll.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c index 9044892a926..a46dfe05205 100644 --- a/src/core/iomgr/pollset_multipoller_with_epoll.c +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -149,12 +149,14 @@ static int multipoll_with_epoll_pollset_maybe_work( static void multipoll_with_epoll_pollset_destroy(grpc_pollset *pollset) { pollset_hdr *h = pollset->data.ptr; + close(h->epoll_fd); gpr_free(h); } static void epoll_kick(grpc_pollset *pollset) { pollset_hdr *h = pollset->data.ptr; + grpc_wakeup_fd_destroy(&h->wakeup_fd); grpc_wakeup_fd_wakeup(&h->wakeup_fd); } From 785778b22ee95c139dbc74b83215a59ae42e32fe Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 13:54:48 -0800 Subject: [PATCH 18/36] added projects for shared libraries --- .../gpr_shared.vcxproj.filters.template | 2 + .../vs2013/gpr_shared.vcxproj.template | 2 + .../gprc_csharp_ext_shared.vcxproj.template | 2 + .../gprc_shared.vcxproj.filters.template | 2 + .../vs2013/gprc_shared.vcxproj.template | 2 + templates/vsprojects/vs2013/grpc.sln.template | 20 +- .../vsprojects/vs2013/vcxproj_defs.include | 15 +- vsprojects/vs2013/gpr_shared.vcxproj | 177 +++++ vsprojects/vs2013/gpr_shared.vcxproj.filters | 211 ++++++ .../vs2013/gprc_csharp_ext_shared.vcxproj | 91 +++ vsprojects/vs2013/gprc_shared.vcxproj | 419 +++++++++++ vsprojects/vs2013/gprc_shared.vcxproj.filters | 703 ++++++++++++++++++ vsprojects/vs2013/grpc.sln | 18 + 13 files changed, 1658 insertions(+), 6 deletions(-) create mode 100644 templates/vsprojects/vs2013/gpr_shared.vcxproj.filters.template create mode 100644 templates/vsprojects/vs2013/gpr_shared.vcxproj.template create mode 100644 templates/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj.template create mode 100644 templates/vsprojects/vs2013/gprc_shared.vcxproj.filters.template create mode 100644 templates/vsprojects/vs2013/gprc_shared.vcxproj.template create mode 100644 vsprojects/vs2013/gpr_shared.vcxproj create mode 100644 vsprojects/vs2013/gpr_shared.vcxproj.filters create mode 100644 vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj create mode 100644 vsprojects/vs2013/gprc_shared.vcxproj create mode 100644 vsprojects/vs2013/gprc_shared.vcxproj.filters diff --git a/templates/vsprojects/vs2013/gpr_shared.vcxproj.filters.template b/templates/vsprojects/vs2013/gpr_shared.vcxproj.filters.template new file mode 100644 index 00000000000..c8b2ce099ea --- /dev/null +++ b/templates/vsprojects/vs2013/gpr_shared.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('gpr', libs, targets)} diff --git a/templates/vsprojects/vs2013/gpr_shared.vcxproj.template b/templates/vsprojects/vs2013/gpr_shared.vcxproj.template new file mode 100644 index 00000000000..d1b1dd3c8ba --- /dev/null +++ b/templates/vsprojects/vs2013/gpr_shared.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('gpr', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}')} diff --git a/templates/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj.template b/templates/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj.template new file mode 100644 index 00000000000..d389792c450 --- /dev/null +++ b/templates/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc_csharp_ext', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{C26D04A8-37C6-44C7-B458-906C9FCE928C}')} diff --git a/templates/vsprojects/vs2013/gprc_shared.vcxproj.filters.template b/templates/vsprojects/vs2013/gprc_shared.vcxproj.filters.template new file mode 100644 index 00000000000..b8e91bd61c4 --- /dev/null +++ b/templates/vsprojects/vs2013/gprc_shared.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc', libs, targets)} diff --git a/templates/vsprojects/vs2013/gprc_shared.vcxproj.template b/templates/vsprojects/vs2013/gprc_shared.vcxproj.template new file mode 100644 index 00000000000..55c2da45332 --- /dev/null +++ b/templates/vsprojects/vs2013/gprc_shared.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}', additional_props = ['ssl', 'winsock'])} diff --git a/templates/vsprojects/vs2013/grpc.sln.template b/templates/vsprojects/vs2013/grpc.sln.template index 18dfb1af423..d17f4a31aa4 100644 --- a/templates/vsprojects/vs2013/grpc.sln.template +++ b/templates/vsprojects/vs2013/grpc.sln.template @@ -23,7 +23,13 @@ Project("${cpp_proj_type}") = "${project.name}", "${project.name}.vcxproj", "${p % endif EndProject % endfor -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +Project("${cpp_proj_type}") = "gpr_shared", "gpr_shared.vcxproj", "{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}" +EndProject +Project("${cpp_proj_type}") = "grpc_shared", "grpc_shared.vcxproj", "{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}" +EndProject +Project("${cpp_proj_type}") = "grpc_csharp_ext_shared", "grpc_csharp_ext_shared.vcxproj", "{C26D04A8-37C6-44C7-B458-906C9FCE928C}" +EndProject +Project("${cpp_proj_type}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "third_party", "third_party", "{DD51818F-0BCA-4035-9E5B-F28A9F87DED4}" EndProject @@ -43,6 +49,18 @@ Global {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Debug|Win32.ActiveCfg = Debug|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Debug|Win32.Build.0 = Debug|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Release|Win32.ActiveCfg = Release|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Release|Win32.Build.0 = Release|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Debug|Win32.ActiveCfg = Debug|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Debug|Win32.Build.0 = Debug|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Release|Win32.ActiveCfg = Release|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Release|Win32.Build.0 = Release|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Debug|Win32.ActiveCfg = Debug|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Debug|Win32.Build.0 = Debug|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Release|Win32.ActiveCfg = Release|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/templates/vsprojects/vs2013/vcxproj_defs.include b/templates/vsprojects/vs2013/vcxproj_defs.include index e21230abb76..bb758037720 100644 --- a/templates/vsprojects/vs2013/vcxproj_defs.include +++ b/templates/vsprojects/vs2013/vcxproj_defs.include @@ -1,7 +1,6 @@ <%def name="to_windows_path(path)">${path.replace('/','\\')}\ -<%def name="get_configuration_type(is_library)">${'StaticLibrary' if is_library else 'Application'}\ <%def name="get_subsystem(is_library)">${'Windows' if is_library else 'Console'}\ -<%def name="gen_project(name, libs, targets)">\ +<%def name="gen_project(name, libs, targets, configuration_type = 'StaticLibrary', project_guid = None, additional_props = [])">\ % for project in vsprojects: % if project.name == name: @@ -17,18 +16,18 @@ - ${project.vs_project_guid} + ${project_guid if project_guid else project.vs_project_guid} - ${get_configuration_type(project.is_library)} + ${configuration_type} true v120 Unicode $(Configuration)\$(ProjectName)\ - ${get_configuration_type(project.is_library)} + ${configuration_type} false v120 true @@ -41,10 +40,16 @@ + % for prop in additional_props: + + % endfor + % for prop in additional_props: + + % endfor diff --git a/vsprojects/vs2013/gpr_shared.vcxproj b/vsprojects/vs2013/gpr_shared.vcxproj new file mode 100644 index 00000000000..e52eac8d176 --- /dev/null +++ b/vsprojects/vs2013/gpr_shared.vcxproj @@ -0,0 +1,177 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0} + + + + DynamicLibrary + true + v120 + Unicode + $(Configuration)\$(ProjectName)\ + + + DynamicLibrary + false + v120 + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vsprojects/vs2013/gpr_shared.vcxproj.filters b/vsprojects/vs2013/gpr_shared.vcxproj.filters new file mode 100644 index 00000000000..20e4e07c49d --- /dev/null +++ b/vsprojects/vs2013/gpr_shared.vcxproj.filters @@ -0,0 +1,211 @@ + + + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + include\grpc\support + + + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + src\core\support + + + + + + {9ea89137-2bf7-b6d9-b7af-7cb4d1b74928} + + + {e6957ec1-85ba-6515-03c0-e12878045b1f} + + + {31c42000-3ed7-95e1-d076-df814b72cdee} + + + {60eb2826-e58b-cb10-a98d-fe04727398a2} + + + {c5e1baa7-de77-beb1-9675-942261648f79} + + + {bb116f2a-ea2a-c233-82da-0c54e3cbfec1} + + + + diff --git a/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj b/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj new file mode 100644 index 00000000000..1ae420e27eb --- /dev/null +++ b/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj @@ -0,0 +1,91 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C26D04A8-37C6-44C7-B458-906C9FCE928C} + + + + DynamicLibrary + true + v120 + Unicode + $(Configuration)\$(ProjectName)\ + + + DynamicLibrary + false + v120 + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + + + + + diff --git a/vsprojects/vs2013/gprc_shared.vcxproj b/vsprojects/vs2013/gprc_shared.vcxproj new file mode 100644 index 00000000000..a6a2caadadc --- /dev/null +++ b/vsprojects/vs2013/gprc_shared.vcxproj @@ -0,0 +1,419 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA} + + + + DynamicLibrary + true + v120 + Unicode + $(Configuration)\$(ProjectName)\ + + + DynamicLibrary + false + v120 + true + Unicode + $(Configuration)\$(ProjectName)\ + + + + + + + + + + + + + + + + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + diff --git a/vsprojects/vs2013/gprc_shared.vcxproj.filters b/vsprojects/vs2013/gprc_shared.vcxproj.filters new file mode 100644 index 00000000000..fed8fb10bfb --- /dev/null +++ b/vsprojects/vs2013/gprc_shared.vcxproj.filters @@ -0,0 +1,703 @@ + + + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\compression + + + src\core\compression + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + include\grpc + + + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\security + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\tsi + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\channel + + + src\core\compression + + + src\core\compression + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\httpcli + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\iomgr + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\json + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\statistics + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\surface + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport\chttp2 + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + src\core\transport + + + + + + {968de0a1-346d-b75a-6f19-6a55119b8235} + + + {880c644d-b84f-cfca-98bd-e145f36232ab} + + + {d538af37-07b2-062b-fa2a-d9f882cb2737} + + + {ea745680-21ea-9c5e-679b-64dc40562d08} + + + {d897b6c3-c555-234e-a589-b4f008063615} + + + {263cb913-dfe6-42a4-096b-cac231f76305} + + + {a9bc00ad-835f-c625-c6d9-6a1324f98b9f} + + + {1baf3894-af37-e647-bdbc-95dc17ed0073} + + + {e665cc0e-b994-d7c5-cc18-2007392019f0} + + + {1d850ac6-e639-4eab-5338-4ba40272fcc9} + + + {0ef49896-2313-4a3f-1ce2-716fa0e5c6ca} + + + {aeb18e82-5d25-0aad-8b02-a0a3470073ce} + + + {168fa1b1-1c18-eb55-9a4d-746bc58df2c1} + + + {b8b623c3-a168-a2b1-0d5f-b70a1f1cd8d2} + + + {0b0f9ab1-efa4-7f03-e446-6fb9b5227e84} + + + + diff --git a/vsprojects/vs2013/grpc.sln b/vsprojects/vs2013/grpc.sln index efc4725ed18..424ae0adbda 100644 --- a/vsprojects/vs2013/grpc.sln +++ b/vsprojects/vs2013/grpc.sln @@ -25,6 +25,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_unsecure", "grpc_unsec {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_shared", "gpr_shared.vcxproj", "{3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_shared", "grpc_shared.vcxproj", "{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_csharp_ext_shared", "grpc_csharp_ext_shared.vcxproj", "{C26D04A8-37C6-44C7-B458-906C9FCE928C}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "third_party\zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "third_party", "third_party", "{DD51818F-0BCA-4035-9E5B-F28A9F87DED4}" @@ -63,6 +69,18 @@ Global {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Debug|Win32.ActiveCfg = Debug|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Debug|Win32.Build.0 = Debug|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Release|Win32.ActiveCfg = Release|Win32 + {3D304D6B-AAF8-428B-AC7D-A698DDDE93C0}.Release|Win32.Build.0 = Release|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Debug|Win32.ActiveCfg = Debug|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Debug|Win32.Build.0 = Debug|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Release|Win32.ActiveCfg = Release|Win32 + {F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}.Release|Win32.Build.0 = Release|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Debug|Win32.ActiveCfg = Debug|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Debug|Win32.Build.0 = Debug|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Release|Win32.ActiveCfg = Release|Win32 + {C26D04A8-37C6-44C7-B458-906C9FCE928C}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 9fb0116148cf91f7597c125875f1f1d6903fd9ec Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 14:09:43 -0800 Subject: [PATCH 19/36] fixed filename of grpc VS project templates --- ...d.vcxproj.template => grpc_csharp_ext_shared.vcxproj.template} | 0 ...proj.filters.template => grpc_shared.vcxproj.filters.template} | 0 ...{gprc_shared.vcxproj.template => grpc_shared.vcxproj.template} | 0 ...c_csharp_ext_shared.vcxproj => grpc_csharp_ext_shared.vcxproj} | 0 vsprojects/vs2013/{gprc_shared.vcxproj => grpc_shared.vcxproj} | 0 .../{gprc_shared.vcxproj.filters => grpc_shared.vcxproj.filters} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename templates/vsprojects/vs2013/{gprc_csharp_ext_shared.vcxproj.template => grpc_csharp_ext_shared.vcxproj.template} (100%) rename templates/vsprojects/vs2013/{gprc_shared.vcxproj.filters.template => grpc_shared.vcxproj.filters.template} (100%) rename templates/vsprojects/vs2013/{gprc_shared.vcxproj.template => grpc_shared.vcxproj.template} (100%) rename vsprojects/vs2013/{gprc_csharp_ext_shared.vcxproj => grpc_csharp_ext_shared.vcxproj} (100%) rename vsprojects/vs2013/{gprc_shared.vcxproj => grpc_shared.vcxproj} (100%) rename vsprojects/vs2013/{gprc_shared.vcxproj.filters => grpc_shared.vcxproj.filters} (100%) diff --git a/templates/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj.template b/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template similarity index 100% rename from templates/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj.template rename to templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template diff --git a/templates/vsprojects/vs2013/gprc_shared.vcxproj.filters.template b/templates/vsprojects/vs2013/grpc_shared.vcxproj.filters.template similarity index 100% rename from templates/vsprojects/vs2013/gprc_shared.vcxproj.filters.template rename to templates/vsprojects/vs2013/grpc_shared.vcxproj.filters.template diff --git a/templates/vsprojects/vs2013/gprc_shared.vcxproj.template b/templates/vsprojects/vs2013/grpc_shared.vcxproj.template similarity index 100% rename from templates/vsprojects/vs2013/gprc_shared.vcxproj.template rename to templates/vsprojects/vs2013/grpc_shared.vcxproj.template diff --git a/vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj b/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj similarity index 100% rename from vsprojects/vs2013/gprc_csharp_ext_shared.vcxproj rename to vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj diff --git a/vsprojects/vs2013/gprc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj similarity index 100% rename from vsprojects/vs2013/gprc_shared.vcxproj rename to vsprojects/vs2013/grpc_shared.vcxproj diff --git a/vsprojects/vs2013/gprc_shared.vcxproj.filters b/vsprojects/vs2013/grpc_shared.vcxproj.filters similarity index 100% rename from vsprojects/vs2013/gprc_shared.vcxproj.filters rename to vsprojects/vs2013/grpc_shared.vcxproj.filters From 31e40652a975c8b633224d0bba3f90a840b9d693 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 14:23:38 -0800 Subject: [PATCH 20/36] fixes to make shared libraries build --- .../vs2013/grpc_csharp_ext_shared.vcxproj.template | 2 +- templates/vsprojects/vs2013/grpc_shared.vcxproj.template | 2 +- templates/vsprojects/vs2013/vcxproj_defs.include | 7 ++++++- vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj | 2 ++ vsprojects/vs2013/grpc_shared.vcxproj | 3 +++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template b/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template index d389792c450..45f37a8c47b 100644 --- a/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template +++ b/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_csharp_ext', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{C26D04A8-37C6-44C7-B458-906C9FCE928C}')} +${gen_project('grpc_csharp_ext', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{C26D04A8-37C6-44C7-B458-906C9FCE928C}', additional_props = ['winsock'])} diff --git a/templates/vsprojects/vs2013/grpc_shared.vcxproj.template b/templates/vsprojects/vs2013/grpc_shared.vcxproj.template index 55c2da45332..890189c28db 100644 --- a/templates/vsprojects/vs2013/grpc_shared.vcxproj.template +++ b/templates/vsprojects/vs2013/grpc_shared.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}', additional_props = ['ssl', 'winsock'])} +${gen_project('grpc', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}', additional_props = ['ssl', 'winsock'], depends_on_zlib = True)} diff --git a/templates/vsprojects/vs2013/vcxproj_defs.include b/templates/vsprojects/vs2013/vcxproj_defs.include index bb758037720..c8e6fd3c06c 100644 --- a/templates/vsprojects/vs2013/vcxproj_defs.include +++ b/templates/vsprojects/vs2013/vcxproj_defs.include @@ -1,6 +1,6 @@ <%def name="to_windows_path(path)">${path.replace('/','\\')}\ <%def name="get_subsystem(is_library)">${'Windows' if is_library else 'Console'}\ -<%def name="gen_project(name, libs, targets, configuration_type = 'StaticLibrary', project_guid = None, additional_props = [])">\ +<%def name="gen_project(name, libs, targets, configuration_type = 'StaticLibrary', project_guid = None, additional_props = [], depends_on_zlib = False)">\ % for project in vsprojects: % if project.name == name: @@ -112,6 +112,11 @@ ${vsproject_dict[dep].vs_project_guid} % endfor + % if depends_on_zlib: + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + % endif % endif diff --git a/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj b/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj index 1ae420e27eb..6ad268e0e97 100644 --- a/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj +++ b/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj @@ -35,10 +35,12 @@ + + diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj index a6a2caadadc..53886467673 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ b/vsprojects/vs2013/grpc_shared.vcxproj @@ -411,6 +411,9 @@ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + From a61221664565fb7fbebc7e48a9cc5f2c3937ddca Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 14:25:24 -0800 Subject: [PATCH 21/36] fixes to zlib VS project --- vsprojects/vs2013/third_party/zlibvc.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsprojects/vs2013/third_party/zlibvc.vcxproj b/vsprojects/vs2013/third_party/zlibvc.vcxproj index dc81fba58c8..b8f0dc10ba1 100644 --- a/vsprojects/vs2013/third_party/zlibvc.vcxproj +++ b/vsprojects/vs2013/third_party/zlibvc.vcxproj @@ -55,7 +55,7 @@ Disabled ..\..\..\third_party\zlib;..\..\..\third_party\zlib\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDebugDLL @@ -106,7 +106,7 @@ OnlyExplicitInline ..\..\..\third_party\zlib;..\..\..\third_party\zlib\contrib\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) true From 5e35b140941099ee25674ef559e5297be3399cbb Mon Sep 17 00:00:00 2001 From: David Klempner Date: Wed, 11 Feb 2015 14:24:46 -0800 Subject: [PATCH 22/36] Disable test caching when runs_per_test > 1 Otherwise the tests just stop once they succeed, or don't even run at all if they passed in a previous run. --- tools/run_tests/run_tests.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index cb54c0db82c..0a42ffc1b53 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -228,8 +228,11 @@ def _build_and_run(check_cancelled, newline_on_success, cache): return 0 -test_cache = TestCache() -test_cache.maybe_load() +if runs_per_test == 1: + test_cache = TestCache() + test_cache.maybe_load() +else: + test_cache = None if forever: success = True @@ -246,7 +249,8 @@ if forever: 'All tests are now passing properly', do_newline=True) jobset.message('IDLE', 'No change detected') - test_cache.save() + if test_cache != None: + test_cache.save() while not have_files_changed(): time.sleep(1) else: From f6ff8f6fcf6b9cdcde226e755ef00fa0bd248b20 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 14:43:11 -0800 Subject: [PATCH 23/36] remove _shared suffix from target dll names --- templates/vsprojects/vs2013/vcxproj_defs.include | 7 ++++++- vsprojects/vs2013/gpr.vcxproj | 7 ++++++- vsprojects/vs2013/gpr_shared.vcxproj | 7 ++++++- vsprojects/vs2013/gpr_test_util.vcxproj | 7 ++++++- vsprojects/vs2013/grpc.vcxproj | 7 ++++++- vsprojects/vs2013/grpc_csharp_ext.vcxproj | 7 ++++++- vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj | 7 ++++++- vsprojects/vs2013/grpc_shared.vcxproj | 7 ++++++- vsprojects/vs2013/grpc_test_util.vcxproj | 7 ++++++- vsprojects/vs2013/grpc_unsecure.vcxproj | 7 ++++++- 10 files changed, 60 insertions(+), 10 deletions(-) diff --git a/templates/vsprojects/vs2013/vcxproj_defs.include b/templates/vsprojects/vs2013/vcxproj_defs.include index c8e6fd3c06c..2bdf0b94ea9 100644 --- a/templates/vsprojects/vs2013/vcxproj_defs.include +++ b/templates/vsprojects/vs2013/vcxproj_defs.include @@ -52,7 +52,12 @@ % endfor - + + ${name} + + + ${name} + NotUsing diff --git a/vsprojects/vs2013/gpr.vcxproj b/vsprojects/vs2013/gpr.vcxproj index e54029390da..959ea331a12 100644 --- a/vsprojects/vs2013/gpr.vcxproj +++ b/vsprojects/vs2013/gpr.vcxproj @@ -41,7 +41,12 @@ - + + gpr + + + gpr + NotUsing diff --git a/vsprojects/vs2013/gpr_shared.vcxproj b/vsprojects/vs2013/gpr_shared.vcxproj index e52eac8d176..0b3d4eab7c6 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj +++ b/vsprojects/vs2013/gpr_shared.vcxproj @@ -41,7 +41,12 @@ - + + gpr + + + gpr + NotUsing diff --git a/vsprojects/vs2013/gpr_test_util.vcxproj b/vsprojects/vs2013/gpr_test_util.vcxproj index 544d737bdaf..59e9ef2aefa 100644 --- a/vsprojects/vs2013/gpr_test_util.vcxproj +++ b/vsprojects/vs2013/gpr_test_util.vcxproj @@ -41,7 +41,12 @@ - + + gpr_test_util + + + gpr_test_util + NotUsing diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index 12428bd4b16..bd87569a3f9 100644 --- a/vsprojects/vs2013/grpc.vcxproj +++ b/vsprojects/vs2013/grpc.vcxproj @@ -41,7 +41,12 @@ - + + grpc + + + grpc + NotUsing diff --git a/vsprojects/vs2013/grpc_csharp_ext.vcxproj b/vsprojects/vs2013/grpc_csharp_ext.vcxproj index 0f355661869..d3ac4725595 100644 --- a/vsprojects/vs2013/grpc_csharp_ext.vcxproj +++ b/vsprojects/vs2013/grpc_csharp_ext.vcxproj @@ -41,7 +41,12 @@ - + + grpc_csharp_ext + + + grpc_csharp_ext + NotUsing diff --git a/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj b/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj index 6ad268e0e97..3c55e608c18 100644 --- a/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj +++ b/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj @@ -43,7 +43,12 @@ - + + grpc_csharp_ext + + + grpc_csharp_ext + NotUsing diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj index 53886467673..b1890cf6e73 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ b/vsprojects/vs2013/grpc_shared.vcxproj @@ -45,7 +45,12 @@ - + + grpc + + + grpc + NotUsing diff --git a/vsprojects/vs2013/grpc_test_util.vcxproj b/vsprojects/vs2013/grpc_test_util.vcxproj index e0e33c0086e..a935fb4feb0 100644 --- a/vsprojects/vs2013/grpc_test_util.vcxproj +++ b/vsprojects/vs2013/grpc_test_util.vcxproj @@ -41,7 +41,12 @@ - + + grpc_test_util + + + grpc_test_util + NotUsing diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index 3dab86c6e94..0e5bdae62f3 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -41,7 +41,12 @@ - + + grpc_unsecure + + + grpc_unsecure + NotUsing From 0af000bfba1fb8d19dc0e5424f38a271ccc772cc Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 11 Feb 2015 14:48:04 -0800 Subject: [PATCH 24/36] Fixing valgrind's codepath in run_tests.py. --- tools/run_tests/run_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index cb54c0db82c..f59bff2a889 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -40,7 +40,7 @@ class ValgrindConfig(object): self.allow_hashing = False def job_spec(self, binary, hash_targets): - return JobSpec(cmdline=['valgrind', '--tool=%s' % self.tool, binary], + return jobset.JobSpec(cmdline=['valgrind', '--tool=%s' % self.tool, binary], hash_targets=None) From 8f24bec047e17154c1514174cd939f9472f433b8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 15:12:21 -0800 Subject: [PATCH 25/36] set RuntimeLibrary for zlib project to default --- vsprojects/vs2013/third_party/zlibvc.vcxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/vsprojects/vs2013/third_party/zlibvc.vcxproj b/vsprojects/vs2013/third_party/zlibvc.vcxproj index b8f0dc10ba1..fb8dea583fe 100644 --- a/vsprojects/vs2013/third_party/zlibvc.vcxproj +++ b/vsprojects/vs2013/third_party/zlibvc.vcxproj @@ -58,7 +58,6 @@ WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDebugDLL false $(IntDir)zlibvc.pch $(IntDir) @@ -110,7 +109,6 @@ true - MultiThreaded false true $(IntDir)zlibvc.pch From 6943fb3aed8bf23681f7cb0277667c33098a3b07 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 9 Feb 2015 17:38:52 -0800 Subject: [PATCH 26/36] added cpu_windows.c --- Makefile | 2 ++ build.json | 1 + src/core/support/cpu_windows.c | 52 +++++++++++++++++++++++++++ vsprojects/vs2013/gpr.vcxproj | 2 ++ vsprojects/vs2013/gpr.vcxproj.filters | 3 ++ 5 files changed, 60 insertions(+) create mode 100644 src/core/support/cpu_windows.c diff --git a/Makefile b/Makefile index 7f4bee71f68..a5b3978109e 100644 --- a/Makefile +++ b/Makefile @@ -1684,6 +1684,7 @@ LIBGPR_SRC = \ src/core/support/cmdline.c \ src/core/support/cpu_linux.c \ src/core/support/cpu_posix.c \ + src/core/support/cpu_windows.c \ src/core/support/env_linux.c \ src/core/support/env_posix.c \ src/core/support/env_win32.c \ @@ -1776,6 +1777,7 @@ objs/$(CONFIG)/src/core/support/cancellable.o: objs/$(CONFIG)/src/core/support/cmdline.o: objs/$(CONFIG)/src/core/support/cpu_linux.o: objs/$(CONFIG)/src/core/support/cpu_posix.o: +objs/$(CONFIG)/src/core/support/cpu_windows.o: objs/$(CONFIG)/src/core/support/env_linux.o: objs/$(CONFIG)/src/core/support/env_posix.o: objs/$(CONFIG)/src/core/support/env_win32.o: diff --git a/build.json b/build.json index bbff314aa26..ca41c8dcb39 100644 --- a/build.json +++ b/build.json @@ -252,6 +252,7 @@ "src/core/support/cmdline.c", "src/core/support/cpu_linux.c", "src/core/support/cpu_posix.c", + "src/core/support/cpu_windows.c", "src/core/support/env_linux.c", "src/core/support/env_posix.c", "src/core/support/env_win32.c", diff --git a/src/core/support/cpu_windows.c b/src/core/support/cpu_windows.c new file mode 100644 index 00000000000..092606336e6 --- /dev/null +++ b/src/core/support/cpu_windows.c @@ -0,0 +1,52 @@ +/* +* +* Copyright 2014, Google Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following disclaimer +* in the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Google Inc. nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include + +#ifdef GPR_WIN32 + +#include "src/core/support/cpu.h" + +#include + +unsigned gpr_cpu_num_cores(void) { + /* TODO: implement */ + return 1; +} + +unsigned gpr_cpu_current_cpu(void) { + /* TODO: implement */ + return 1; +} + +#endif /* GPR_WIN32 */ diff --git a/vsprojects/vs2013/gpr.vcxproj b/vsprojects/vs2013/gpr.vcxproj index e54029390da..264543ad731 100644 --- a/vsprojects/vs2013/gpr.vcxproj +++ b/vsprojects/vs2013/gpr.vcxproj @@ -115,6 +115,8 @@ + + diff --git a/vsprojects/vs2013/gpr.vcxproj.filters b/vsprojects/vs2013/gpr.vcxproj.filters index 20e4e07c49d..1e908a5ba51 100644 --- a/vsprojects/vs2013/gpr.vcxproj.filters +++ b/vsprojects/vs2013/gpr.vcxproj.filters @@ -16,6 +16,9 @@ src\core\support + + src\core\support + src\core\support From 2cdacb8d2e128bf05c7d0157b7c386b69f1b9930 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 15:31:49 -0800 Subject: [PATCH 27/36] added log messages for cpu_windows.c --- src/core/support/cpu_windows.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/support/cpu_windows.c b/src/core/support/cpu_windows.c index 092606336e6..c533f9d554b 100644 --- a/src/core/support/cpu_windows.c +++ b/src/core/support/cpu_windows.c @@ -40,13 +40,15 @@ #include unsigned gpr_cpu_num_cores(void) { - /* TODO: implement */ + /* TODO(jtattermusch): implement */ + gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1"); return 1; } unsigned gpr_cpu_current_cpu(void) { - /* TODO: implement */ - return 1; + /* TODO(jtattermusch): implement */ + gpr_log(GPR_ERROR, "Cannot determine current CPU"); + return 0; } #endif /* GPR_WIN32 */ From 24cad9b6c6542b6c4d79a0204d69ddce205657ea Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 11 Feb 2015 15:51:31 -0800 Subject: [PATCH 28/36] Enabling debug symbols while running batched tests under Windows. --- .../vs2013/build_and_run_tests.bat.template | 4 +- vsprojects/vs2013/build_and_run_tests.bat | 56 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/templates/vsprojects/vs2013/build_and_run_tests.bat.template b/templates/vsprojects/vs2013/build_and_run_tests.bat.template index 4a15e01c522..d7ec0e8dd1f 100644 --- a/templates/vsprojects/vs2013/build_and_run_tests.bat.template +++ b/templates/vsprojects/vs2013/build_and_run_tests.bat.template @@ -19,12 +19,12 @@ mkdir ${test_bin_dir} % for target in test_targets: echo Building test ${target.name} -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:${test_bin_dir}\ \ +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:${test_bin_dir}\ \ %for source in target.src: ..\..\${to_windows_path(source)} \ %endfor -link.exe /OUT:"${test_bin_dir}\${target.name}.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 \ +link.exe /DEBUG /OUT:"${test_bin_dir}\${target.name}.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 \ %for dep in target.deps: Debug\${dep}.lib \ %endfor diff --git a/vsprojects/vs2013/build_and_run_tests.bat b/vsprojects/vs2013/build_and_run_tests.bat index ac941ba9f28..dc9e642cb72 100644 --- a/vsprojects/vs2013/build_and_run_tests.bat +++ b/vsprojects/vs2013/build_and_run_tests.bat @@ -10,112 +10,112 @@ MSBuild.exe gpr_test_util.vcxproj /p:Configuration=Debug mkdir test_bin echo Building test gpr_cancellable_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\cancellable_test.c -link.exe /OUT:"test_bin\gpr_cancellable_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\cancellable_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\cancellable_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_cancellable_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\cancellable_test.obj echo( echo Running test gpr_cancellable_test test_bin\gpr_cancellable_test.exe || echo TEST FAILED: gpr_cancellable_test && exit /b echo( echo Building test gpr_cmdline_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\cmdline_test.c -link.exe /OUT:"test_bin\gpr_cmdline_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\cmdline_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\cmdline_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_cmdline_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\cmdline_test.obj echo( echo Running test gpr_cmdline_test test_bin\gpr_cmdline_test.exe || echo TEST FAILED: gpr_cmdline_test && exit /b echo( echo Building test gpr_env_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\env_test.c -link.exe /OUT:"test_bin\gpr_env_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\env_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\env_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_env_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\env_test.obj echo( echo Running test gpr_env_test test_bin\gpr_env_test.exe || echo TEST FAILED: gpr_env_test && exit /b echo( echo Building test gpr_file_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\file_test.c -link.exe /OUT:"test_bin\gpr_file_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\file_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\file_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_file_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\file_test.obj echo( echo Running test gpr_file_test test_bin\gpr_file_test.exe || echo TEST FAILED: gpr_file_test && exit /b echo( echo Building test gpr_histogram_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\histogram_test.c -link.exe /OUT:"test_bin\gpr_histogram_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\histogram_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\histogram_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_histogram_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\histogram_test.obj echo( echo Running test gpr_histogram_test test_bin\gpr_histogram_test.exe || echo TEST FAILED: gpr_histogram_test && exit /b echo( echo Building test gpr_host_port_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\host_port_test.c -link.exe /OUT:"test_bin\gpr_host_port_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\host_port_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\host_port_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_host_port_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\host_port_test.obj echo( echo Running test gpr_host_port_test test_bin\gpr_host_port_test.exe || echo TEST FAILED: gpr_host_port_test && exit /b echo( echo Building test gpr_log_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\log_test.c -link.exe /OUT:"test_bin\gpr_log_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\log_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\log_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_log_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\log_test.obj echo( echo Running test gpr_log_test test_bin\gpr_log_test.exe || echo TEST FAILED: gpr_log_test && exit /b echo( echo Building test gpr_slice_buffer_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\slice_buffer_test.c -link.exe /OUT:"test_bin\gpr_slice_buffer_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\slice_buffer_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\slice_buffer_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_slice_buffer_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\slice_buffer_test.obj echo( echo Running test gpr_slice_buffer_test test_bin\gpr_slice_buffer_test.exe || echo TEST FAILED: gpr_slice_buffer_test && exit /b echo( echo Building test gpr_slice_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\slice_test.c -link.exe /OUT:"test_bin\gpr_slice_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\slice_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\slice_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_slice_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\slice_test.obj echo( echo Running test gpr_slice_test test_bin\gpr_slice_test.exe || echo TEST FAILED: gpr_slice_test && exit /b echo( echo Building test gpr_string_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\string_test.c -link.exe /OUT:"test_bin\gpr_string_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\string_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\string_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_string_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\string_test.obj echo( echo Running test gpr_string_test test_bin\gpr_string_test.exe || echo TEST FAILED: gpr_string_test && exit /b echo( echo Building test gpr_sync_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\sync_test.c -link.exe /OUT:"test_bin\gpr_sync_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\sync_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\sync_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_sync_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\sync_test.obj echo( echo Running test gpr_sync_test test_bin\gpr_sync_test.exe || echo TEST FAILED: gpr_sync_test && exit /b echo( echo Building test gpr_thd_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\thd_test.c -link.exe /OUT:"test_bin\gpr_thd_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\thd_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\thd_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_thd_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\thd_test.obj echo( echo Running test gpr_thd_test test_bin\gpr_thd_test.exe || echo TEST FAILED: gpr_thd_test && exit /b echo( echo Building test gpr_time_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\time_test.c -link.exe /OUT:"test_bin\gpr_time_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\time_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\time_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_time_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\time_test.obj echo( echo Running test gpr_time_test test_bin\gpr_time_test.exe || echo TEST FAILED: gpr_time_test && exit /b echo( echo Building test gpr_useful_test -cl.exe /c /I..\.. /I..\..\include /nologo /ZI /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\useful_test.c -link.exe /OUT:"test_bin\gpr_useful_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\useful_test.obj +cl.exe /c /I..\.. /I..\..\include /nologo /Z7 /W3 /WX- /sdl /D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- /Fo:test_bin\ ..\..\test\core\support\useful_test.c +link.exe /DEBUG /OUT:"test_bin\gpr_useful_test.exe" /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 Debug\gpr_test_util.lib Debug\gpr.lib test_bin\useful_test.obj echo( echo Running test gpr_useful_test test_bin\gpr_useful_test.exe || echo TEST FAILED: gpr_useful_test && exit /b From 2573958e844ecfb03203d486cbac7ce500401395 Mon Sep 17 00:00:00 2001 From: David Klempner Date: Wed, 11 Feb 2015 15:57:32 -0800 Subject: [PATCH 29/36] Change TestCache to parameterize whether to skip running tests. This allows caching results with --runs_per_test. --- tools/run_tests/run_tests.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0a42ffc1b53..8b9cb9dc6de 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -180,14 +180,17 @@ forever = args.forever class TestCache(object): """Cache for running tests.""" - def __init__(self): + def __init__(self, use_cache_results): self._last_successful_run = {} + self._use_cache_results = use_cache_results def should_run(self, cmdline, bin_hash): if cmdline not in self._last_successful_run: return True if self._last_successful_run[cmdline] != bin_hash: return True + if not self._use_cache_results: + return True return False def finished(self, cmdline, bin_hash): @@ -228,11 +231,8 @@ def _build_and_run(check_cancelled, newline_on_success, cache): return 0 -if runs_per_test == 1: - test_cache = TestCache() - test_cache.maybe_load() -else: - test_cache = None +test_cache = TestCache(runs_per_test == 1) +test_cache.maybe_load() if forever: success = True @@ -249,8 +249,7 @@ if forever: 'All tests are now passing properly', do_newline=True) jobset.message('IDLE', 'No change detected') - if test_cache != None: - test_cache.save() + test_cache.save() while not have_files_changed(): time.sleep(1) else: From df80ba81c9c254e1aa8afa6808fac6ae7a589e9b Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 11 Feb 2015 16:05:29 -0800 Subject: [PATCH 30/36] Freeing the proper string in gpr_tmpfile. Fixes #478. (oops) --- src/core/support/file_win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/support/file_win32.c b/src/core/support/file_win32.c index af7eebe3de8..7749d4553f7 100644 --- a/src/core/support/file_win32.c +++ b/src/core/support/file_win32.c @@ -76,7 +76,7 @@ end: *tmp_filename_out = gpr_tchar_to_char(tmp_filename); } - gpr_free(tmp_filename); + gpr_free(template_string); return result; } From 630f1b842e4d4bfdd364b2f87fce53101f6267d4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 16:15:39 -0800 Subject: [PATCH 31/36] Update completion type enum to reflect changes in grpc.h --- src/csharp/GrpcCore/Internal/Enums.cs | 37 ++++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/csharp/GrpcCore/Internal/Enums.cs b/src/csharp/GrpcCore/Internal/Enums.cs index 46e3bca6ebe..1151e948992 100644 --- a/src/csharp/GrpcCore/Internal/Enums.cs +++ b/src/csharp/GrpcCore/Internal/Enums.cs @@ -36,29 +36,36 @@ namespace Google.GRPC.Core.Internal /// internal enum GRPCCompletionType { - GRPC_QUEUE_SHUTDOWN, /* Shutting down */ - GRPC_READ, + GRPC_QUEUE_SHUTDOWN, + + /* operation completion */ + GRPC_OP_COMPLETE, + /* A read has completed */ - GRPC_INVOKE_ACCEPTED, - /* An invoke call has been accepted by flow - control */ + GRPC_READ, + + /* A write has been accepted by flow control */ GRPC_WRITE_ACCEPTED, - /* A write has been accepted by - flow control */ - GRPC_FINISH_ACCEPTED, + /* writes_done or write_status has been accepted */ + GRPC_FINISH_ACCEPTED, + + /* The metadata array sent by server received at client */ GRPC_CLIENT_METADATA_READ, - /* The metadata array sent by server received at - client */ + + /* An RPC has finished. The event contains status. + * On the server this will be OK or Cancelled. */ GRPC_FINISHED, - /* An RPC has finished. The event contains status. - On the server this will be OK or Cancelled. */ - GRPC_SERVER_RPC_NEW, + /* A new RPC has arrived at the server */ + GRPC_SERVER_RPC_NEW, + + /* The server has finished shutting down */ + GRPC_SERVER_SHUTDOWN, + + /* must be last, forces users to include a default: case */ GRPC_COMPLETION_DO_NOT_USE - /* must be last, forces users to include - a default: case */ } /// From 20b738d778377ba84057dcba4b5a5c00d1a47c60 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 11 Feb 2015 16:26:12 -0800 Subject: [PATCH 32/36] reference windows-style library names in DllImport, mono still finds the right library --- src/csharp/GrpcCore/GrpcEnvironment.cs | 4 +- .../GrpcCore/Internal/CallSafeHandle.cs | 36 ++++++++--------- .../GrpcCore/Internal/ChannelSafeHandle.cs | 4 +- .../Internal/CompletionQueueSafeHandle.cs | 12 +++--- src/csharp/GrpcCore/Internal/Event.cs | 40 +++++++++---------- .../GrpcCore/Internal/ServerSafeHandle.cs | 16 ++++---- src/csharp/GrpcCore/Internal/Timespec.cs | 2 +- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/csharp/GrpcCore/GrpcEnvironment.cs b/src/csharp/GrpcCore/GrpcEnvironment.cs index 7a644f49619..201320828bd 100644 --- a/src/csharp/GrpcCore/GrpcEnvironment.cs +++ b/src/csharp/GrpcCore/GrpcEnvironment.cs @@ -13,10 +13,10 @@ namespace Google.GRPC.Core { const int THREAD_POOL_SIZE = 1; - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_init(); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_shutdown(); static object staticLock = new object(); diff --git a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs index 6c9c58a4c3f..bbb830b3552 100644 --- a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs @@ -15,66 +15,66 @@ namespace Google.GRPC.Core.Internal { const UInt32 GRPC_WRITE_BUFFER_HINT = 1; - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern CallSafeHandle grpc_channel_create_call_old(ChannelSafeHandle channel, string method, string host, Timespec deadline); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_add_metadata(CallSafeHandle call, IntPtr metadata, UInt32 flags); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_invoke_old(CallSafeHandle call, CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, UInt32 flags); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_invoke_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_invoke_old")] static extern GRPCCallError grpc_call_invoke_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle cq, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate metadataReadCallback, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback, UInt32 flags); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_server_accept_old(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, IntPtr finishedTag); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_server_accept_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_server_accept_old")] static extern GRPCCallError grpc_call_server_accept_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_server_end_initial_metadata_old(CallSafeHandle call, UInt32 flags); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_cancel(CallSafeHandle call); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_start_write_status_old(CallSafeHandle call, StatusCode statusCode, string statusMessage, IntPtr tag); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_start_write_status_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_start_write_status_old")] static extern GRPCCallError grpc_call_start_write_status_old_CALLBACK(CallSafeHandle call, StatusCode statusCode, string statusMessage, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_writes_done_old(CallSafeHandle call, IntPtr tag); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_writes_done_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_writes_done_old")] static extern GRPCCallError grpc_call_writes_done_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern GRPCCallError grpc_call_start_read_old(CallSafeHandle call, IntPtr tag); - [DllImport("libgrpc.so", EntryPoint = "grpc_call_start_read_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_call_start_read_old")] static extern GRPCCallError grpc_call_start_read_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern void grpc_call_start_write_from_copied_buffer(CallSafeHandle call, byte[] buffer, UIntPtr length, IntPtr tag, UInt32 flags); - [DllImport("libgrpc_csharp_ext.so", EntryPoint = "grpc_call_start_write_from_copied_buffer")] + [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpc_call_start_write_from_copied_buffer")] static extern void grpc_call_start_write_from_copied_buffer_CALLBACK(CallSafeHandle call, byte[] buffer, UIntPtr length, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback, UInt32 flags); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_call_destroy(IntPtr call); private CallSafeHandle() diff --git a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs index 3a09d8b1b64..0f38d63f98c 100644 --- a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs @@ -10,10 +10,10 @@ namespace Google.GRPC.Core.Internal /// internal class ChannelSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern ChannelSafeHandle grpc_channel_create(string target, IntPtr channelArgs); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_channel_destroy(IntPtr channel); private ChannelSafeHandle() diff --git a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs index 73dd3edde33..f098de68205 100644 --- a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs @@ -9,22 +9,22 @@ namespace Google.GRPC.Core.Internal /// internal class CompletionQueueSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern CompletionQueueSafeHandle grpc_completion_queue_create(); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern EventSafeHandle grpc_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag, Timespec deadline); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern EventSafeHandle grpc_completion_queue_next(CompletionQueueSafeHandle cq, Timespec deadline); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_completion_queue_shutdown(CompletionQueueSafeHandle cq); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCCompletionType grpc_completion_queue_next_with_callback(CompletionQueueSafeHandle cq); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_completion_queue_destroy(IntPtr cq); private CompletionQueueSafeHandle() diff --git a/src/csharp/GrpcCore/Internal/Event.cs b/src/csharp/GrpcCore/Internal/Event.cs index 7056005ba65..5853ddd5704 100644 --- a/src/csharp/GrpcCore/Internal/Event.cs +++ b/src/csharp/GrpcCore/Internal/Event.cs @@ -9,34 +9,34 @@ namespace Google.GRPC.Core.Internal /// internal class EventSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_event_finish(IntPtr ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCCompletionType grpc_event_type(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern CallSafeHandle grpc_event_call(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCOpError grpc_event_write_accepted(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCOpError grpc_event_finish_accepted(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern StatusCode grpc_event_finished_status(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_finished_details(EventSafeHandle ev); // returns const char* - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_read_length(EventSafeHandle ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern void grpc_event_read_copy_to_buffer(EventSafeHandle ev, byte[] buffer, UIntPtr bufferLen); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_server_rpc_new_method(EventSafeHandle ev); // returns const char* public GRPCCompletionType GetCompletionType() @@ -98,34 +98,34 @@ namespace Google.GRPC.Core.Internal /// internal class EventSafeHandleNotOwned : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_event_finish(IntPtr ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCCompletionType grpc_event_type(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern CallSafeHandle grpc_event_call(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCOpError grpc_event_write_accepted(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern GRPCOpError grpc_event_finish_accepted(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern StatusCode grpc_event_finished_status(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_finished_details(EventSafeHandleNotOwned ev); // returns const char* - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_read_length(EventSafeHandleNotOwned ev); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern void grpc_event_read_copy_to_buffer(EventSafeHandleNotOwned ev, byte[] buffer, UIntPtr bufferLen); - [DllImport("libgrpc_csharp_ext.so")] + [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpc_event_server_rpc_new_method(EventSafeHandleNotOwned ev); // returns const char* public EventSafeHandleNotOwned() : base(false) diff --git a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs index 08d4cf01927..d363b34f0b9 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -10,30 +10,30 @@ namespace Google.GRPC.Core.Internal /// internal sealed class ServerSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("libgrpc.so", EntryPoint = "grpc_server_request_call_old")] + [DllImport("grpc.dll", EntryPoint = "grpc_server_request_call_old")] static extern GRPCCallError grpc_server_request_call_old_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern ServerSafeHandle grpc_server_create(CompletionQueueSafeHandle cq, IntPtr args); // TODO: check int representation size - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern int grpc_server_add_http2_port(ServerSafeHandle server, string addr); // TODO: check int representation size - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern int grpc_server_add_secure_http2_port(ServerSafeHandle server, string addr); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_server_start(ServerSafeHandle server); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_server_shutdown(ServerSafeHandle server); - [DllImport("libgrpc.so", EntryPoint = "grpc_server_shutdown_and_notify")] + [DllImport("grpc.dll", EntryPoint = "grpc_server_shutdown_and_notify")] static extern void grpc_server_shutdown_and_notify_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); - [DllImport("libgrpc.so")] + [DllImport("grpc.dll")] static extern void grpc_server_destroy(IntPtr server); private ServerSafeHandle() diff --git a/src/csharp/GrpcCore/Internal/Timespec.cs b/src/csharp/GrpcCore/Internal/Timespec.cs index 8ffaf70bbfb..5a197e121c9 100644 --- a/src/csharp/GrpcCore/Internal/Timespec.cs +++ b/src/csharp/GrpcCore/Internal/Timespec.cs @@ -13,7 +13,7 @@ namespace Google.GRPC.Core.Internal const int nanosPerSecond = 1000 * 1000 * 1000; const int nanosPerTick = 100; - [DllImport("libgpr.so")] + [DllImport("gpr.dll")] static extern Timespec gpr_now(); // TODO: this only works on 64bit linux, can we autoselect the right size of ints? From 5fa1c3fb6036b4220cb03941ebc17bae6da43cac Mon Sep 17 00:00:00 2001 From: David Klempner Date: Wed, 11 Feb 2015 17:06:43 -0800 Subject: [PATCH 33/36] Destroy the wakeup fd in the right function --- src/core/iomgr/pollset_multipoller_with_epoll.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c index a46dfe05205..9fb28195062 100644 --- a/src/core/iomgr/pollset_multipoller_with_epoll.c +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -149,14 +149,13 @@ static int multipoll_with_epoll_pollset_maybe_work( static void multipoll_with_epoll_pollset_destroy(grpc_pollset *pollset) { pollset_hdr *h = pollset->data.ptr; - + grpc_wakeup_fd_destroy(&h->wakeup_fd); close(h->epoll_fd); gpr_free(h); } static void epoll_kick(grpc_pollset *pollset) { pollset_hdr *h = pollset->data.ptr; - grpc_wakeup_fd_destroy(&h->wakeup_fd); grpc_wakeup_fd_wakeup(&h->wakeup_fd); } From 1407adb2a1d6a92d595ae616b7b70e5367e84bfd Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Wed, 11 Feb 2015 17:20:59 -0800 Subject: [PATCH 34/36] Ran build-cleaner, and re-generated project files. --- build.json | 8 ++++---- vsprojects/vs2013/gpr_shared.vcxproj | 2 ++ vsprojects/vs2013/gpr_shared.vcxproj.filters | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build.json b/build.json index ca41c8dcb39..401ef051924 100644 --- a/build.json +++ b/build.json @@ -1628,7 +1628,6 @@ { "name": "qps_client", "build": "test", - "run": false, "language": "c++", "src": [ "test/cpp/qps/qpstest.proto", @@ -1641,12 +1640,12 @@ "grpc", "gpr_test_util", "gpr" - ] + ], + "run": false }, { "name": "qps_server", "build": "test", - "run": false, "language": "c++", "src": [ "test/cpp/qps/qpstest.proto", @@ -1659,7 +1658,8 @@ "grpc", "gpr_test_util", "gpr" - ] + ], + "run": false }, { "name": "ruby_plugin", diff --git a/vsprojects/vs2013/gpr_shared.vcxproj b/vsprojects/vs2013/gpr_shared.vcxproj index 0b3d4eab7c6..b9131e381c1 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj +++ b/vsprojects/vs2013/gpr_shared.vcxproj @@ -120,6 +120,8 @@ + + diff --git a/vsprojects/vs2013/gpr_shared.vcxproj.filters b/vsprojects/vs2013/gpr_shared.vcxproj.filters index 20e4e07c49d..1e908a5ba51 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj.filters +++ b/vsprojects/vs2013/gpr_shared.vcxproj.filters @@ -16,6 +16,9 @@ src\core\support + + src\core\support + src\core\support From 9d085a32d826ff16a8f4a398600830df1d8ad9e5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 18:17:01 -0800 Subject: [PATCH 35/36] Generate more pleasing build.json output run: was getting a little lost --- build.json | 44 ++++++++++++++++----------------- tools/buildgen/build-cleaner.py | 1 + 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/build.json b/build.json index 401ef051924..d3e496e3799 100644 --- a/build.json +++ b/build.json @@ -760,6 +760,7 @@ { "name": "echo_client", "build": "test", + "run": false, "language": "c", "src": [ "test/core/echo/client.c" @@ -769,12 +770,12 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "echo_server", "build": "test", + "run": false, "language": "c", "src": [ "test/core/echo/server.c" @@ -784,8 +785,7 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "echo_test", @@ -818,6 +818,7 @@ { "name": "fling_client", "build": "test", + "run": false, "language": "c", "src": [ "test/core/fling/client.c" @@ -827,12 +828,12 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "fling_server", "build": "test", + "run": false, "language": "c", "src": [ "test/core/fling/server.c" @@ -842,8 +843,7 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "fling_stream_test", @@ -1253,6 +1253,7 @@ { "name": "json_rewrite", "build": "test", + "run": false, "language": "c", "src": [ "test/core/json/json_rewrite.c" @@ -1260,12 +1261,12 @@ "deps": [ "grpc", "gpr" - ], - "run": false + ] }, { "name": "json_rewrite_test", "build": "test", + "run": false, "language": "c", "src": [ "test/core/json/json_rewrite_test.c" @@ -1275,8 +1276,7 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "json_test", @@ -1588,6 +1588,7 @@ { "name": "interop_client", "build": "test", + "run": false, "language": "c++", "src": [ "test/cpp/interop/empty.proto", @@ -1602,12 +1603,12 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "interop_server", "build": "test", + "run": false, "language": "c++", "src": [ "test/cpp/interop/empty.proto", @@ -1622,12 +1623,12 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "qps_client", "build": "test", + "run": false, "language": "c++", "src": [ "test/cpp/qps/qpstest.proto", @@ -1640,12 +1641,12 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "qps_server", "build": "test", + "run": false, "language": "c++", "src": [ "test/cpp/qps/qpstest.proto", @@ -1658,8 +1659,7 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "ruby_plugin", @@ -1727,6 +1727,7 @@ { "name": "tips_client", "build": "test", + "run": false, "language": "c++", "src": [ "examples/tips/main.cc" @@ -1739,8 +1740,7 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "tips_publisher_test", diff --git a/tools/buildgen/build-cleaner.py b/tools/buildgen/build-cleaner.py index 4992beb8970..6477ad202fa 100755 --- a/tools/buildgen/build-cleaner.py +++ b/tools/buildgen/build-cleaner.py @@ -13,6 +13,7 @@ _VERSION_KEYS = ['major', 'minor', 'micro', 'build'] _ELEM_KEYS = [ 'name', 'build', + 'run', 'language', 'public_headers', 'headers', From 04c447977eef65fcd935b9d0326f14898b054692 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 12 Feb 2015 12:20:46 -0800 Subject: [PATCH 36/36] Fix race in call.c --- src/core/surface/call.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 0af21548423..c0f5742c108 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -514,32 +514,32 @@ static void finish_ioreq_op(grpc_call *call, grpc_ioreq_op op, } } -static void finish_send_op(grpc_call *call, grpc_ioreq_op op, +static void finish_send_op(grpc_call *call, grpc_ioreq_op op, write_state ws, grpc_op_error error) { lock(call); finish_ioreq_op(call, op, error); call->sending = 0; + call->write_state = ws; unlock(call); grpc_call_internal_unref(call, 0); } static void finish_write_step(void *pc, grpc_op_error error) { - finish_send_op(pc, GRPC_IOREQ_SEND_MESSAGE, error); + finish_send_op(pc, GRPC_IOREQ_SEND_MESSAGE, WRITE_STATE_STARTED, error); } static void finish_finish_step(void *pc, grpc_op_error error) { - finish_send_op(pc, GRPC_IOREQ_SEND_CLOSE, error); + finish_send_op(pc, GRPC_IOREQ_SEND_CLOSE, WRITE_STATE_WRITE_CLOSED, error); } static void finish_start_step(void *pc, grpc_op_error error) { - finish_send_op(pc, GRPC_IOREQ_SEND_INITIAL_METADATA, 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)) { - call->write_state = WRITE_STATE_STARTED; if (is_op_live(call, GRPC_IOREQ_SEND_MESSAGE) || is_op_live(call, GRPC_IOREQ_SEND_CLOSE)) { return SEND_BUFFERED_INITIAL_METADATA; } else { @@ -555,7 +555,6 @@ static send_action choose_send_action(grpc_call *call) { return SEND_MESSAGE; } } else if (is_op_live(call, GRPC_IOREQ_SEND_CLOSE)) { - call->write_state = WRITE_STATE_WRITE_CLOSED; finish_ioreq_op(call, GRPC_IOREQ_SEND_TRAILING_METADATA, GRPC_OP_OK); finish_ioreq_op(call, GRPC_IOREQ_SEND_STATUS, GRPC_OP_OK); if (call->is_client) {