Merge github.com:grpc/grpc into we-dont-need-no-backup

pull/1888/head
Craig Tiller 10 years ago
commit 0596621ec2
  1. 3
      BUILD
  2. 237
      Makefile
  3. 2
      README.md
  4. 15
      build.json
  5. 65
      doc/connection-backoff.md
  6. 24
      doc/interop-test-descriptions.md
  7. 4
      include/grpc/support/port_platform.h
  8. 49
      include/grpc/support/subprocess.h
  9. 2
      include/grpc/support/tls.h
  10. 6
      include/grpc/support/tls_pthread.h
  11. 34
      src/core/security/security_connector.c
  12. 108
      src/core/support/subprocess_posix.c
  13. 45
      src/core/support/tls_pthread.c
  14. 106
      src/core/tsi/ssl_transport_security.c
  15. 8
      src/core/tsi/ssl_transport_security.h
  16. 97
      src/core/tsi/transport_security.c
  17. 9
      src/core/tsi/transport_security.h
  18. 37
      src/core/tsi/transport_security_interface.h
  19. 1
      src/csharp/.gitignore
  20. 1
      src/csharp/EXPERIMENTAL-ONLY
  21. 26
      src/csharp/Grpc.Auth/Grpc.Auth.nuspec
  22. 4
      src/csharp/Grpc.Auth/Properties/AssemblyInfo.cs
  23. 2
      src/csharp/Grpc.Core.Tests/Properties/AssemblyInfo.cs
  24. 1
      src/csharp/Grpc.Core/.gitignore
  25. 12
      src/csharp/Grpc.Core/Grpc.Core.nuspec
  26. 2
      src/csharp/Grpc.Core/Properties/AssemblyInfo.cs
  27. 2
      src/csharp/Grpc.Examples.MathClient/Properties/AssemblyInfo.cs
  28. 2
      src/csharp/Grpc.Examples.MathServer/Properties/AssemblyInfo.cs
  29. 2
      src/csharp/Grpc.Examples.Tests/Properties/AssemblyInfo.cs
  30. 2
      src/csharp/Grpc.Examples/Properties/AssemblyInfo.cs
  31. 2
      src/csharp/Grpc.IntegrationTesting.Client/Properties/AssemblyInfo.cs
  32. 2
      src/csharp/Grpc.IntegrationTesting.Server/Properties/AssemblyInfo.cs
  33. 2
      src/csharp/Grpc.IntegrationTesting/Properties/AssemblyInfo.cs
  34. 13
      src/csharp/Grpc.nuspec
  35. 111
      src/csharp/README.md
  36. 16
      src/csharp/build_packages.bat
  37. 18
      src/csharp/buildall.bat
  38. 16
      src/node/interop/interop_client.js
  39. 13
      src/node/src/client.js
  40. 4
      src/node/test/interop_sanity_test.js
  41. 14
      src/objective-c/GRPCClient/private/GRPCChannel.m
  42. 63
      src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
  43. 2
      src/php/bin/interop_client.sh
  44. 2
      src/php/bin/run_tests.sh
  45. 17
      src/php/ext/grpc/call.c
  46. 4
      src/php/ext/grpc/call.h
  47. 50
      src/php/ext/grpc/completion_queue.c
  48. 50
      src/php/ext/grpc/completion_queue.h
  49. 2
      src/php/ext/grpc/config.m4
  50. 3
      src/php/ext/grpc/php_grpc.c
  51. 19
      src/php/ext/grpc/server.c
  52. 1
      src/php/ext/grpc/server.h
  53. 16
      src/php/tests/generated_code/math.proto
  54. 14
      src/ruby/bin/math.proto
  55. 2
      templates/Makefile.template
  56. 1
      test/core/end2end/gen_build_json.py
  57. 7
      test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
  58. 81
      test/core/fling/fling_test.c
  59. 11
      test/core/tsi/transport_security_test.c
  60. 66
      tools/dockerfile/grpc_java_android/Dockerfile
  61. 42
      tools/dockerfile/grpc_java_android/README.md
  62. 30
      tools/gce_setup/cloud_prod_runner.sh
  63. 15
      tools/gce_setup/grpc_docker.sh
  64. 4
      tools/gce_setup/interop_test.sh
  65. 2
      tools/run_tests/run_node.sh
  66. 8
      tools/run_tests/run_tests.py
  67. 97
      tools/run_tests/tests.json
  68. 71
      vsprojects/Grpc.mak
  69. 5
      vsprojects/gpr/gpr.vcxproj
  70. 9
      vsprojects/gpr/gpr.vcxproj.filters
  71. 6
      vsprojects/nuget_package/README.md
  72. 4
      vsprojects/nuget_package/grpc.native.csharp_ext.nuspec

@ -74,6 +74,7 @@ cc_library(
"src/core/support/string.c",
"src/core/support/string_posix.c",
"src/core/support/string_win32.c",
"src/core/support/subprocess_posix.c",
"src/core/support/sync.c",
"src/core/support/sync_posix.c",
"src/core/support/sync_win32.c",
@ -83,6 +84,7 @@ cc_library(
"src/core/support/time.c",
"src/core/support/time_posix.c",
"src/core/support/time_win32.c",
"src/core/support/tls_pthread.c",
],
hdrs = [
"include/grpc/support/alloc.h",
@ -100,6 +102,7 @@ cc_library(
"include/grpc/support/port_platform.h",
"include/grpc/support/slice.h",
"include/grpc/support/slice_buffer.h",
"include/grpc/support/subprocess.h",
"include/grpc/support/sync.h",
"include/grpc/support/sync_generic.h",
"include/grpc/support/sync_posix.h",

File diff suppressed because one or more lines are too long

@ -37,7 +37,7 @@ Libraries in different languages are in different state of development. We are s
* C++ Library: [src/cpp] (src/cpp) : Early adopter ready - Alpha.
* Ruby Library: [src/ruby] (src/ruby) : Early adopter ready - Alpha.
* NodeJS Library: [src/node] (src/node) : Early adopter ready - Alpha.
* Python Library: [src/python] (src/python) : Usable with limitations - Pre-Alpha.
* Python Library: [src/python] (src/python) : Usable with limitations - Alpha.
* PHP Library: [src/php] (src/php) : Pre-Alpha.
* C# Library: [src/csharp] (src/csharp) : Pre-Alpha.
* Objective-C Library: [src/objective-c] (src/objective-c): Pre-Alpha.

@ -319,6 +319,7 @@
"include/grpc/support/port_platform.h",
"include/grpc/support/slice.h",
"include/grpc/support/slice_buffer.h",
"include/grpc/support/subprocess.h",
"include/grpc/support/sync.h",
"include/grpc/support/sync_generic.h",
"include/grpc/support/sync_posix.h",
@ -366,6 +367,7 @@
"src/core/support/string.c",
"src/core/support/string_posix.c",
"src/core/support/string_win32.c",
"src/core/support/subprocess_posix.c",
"src/core/support/sync.c",
"src/core/support/sync_posix.c",
"src/core/support/sync_win32.c",
@ -374,7 +376,8 @@
"src/core/support/thd_win32.c",
"src/core/support/time.c",
"src/core/support/time_posix.c",
"src/core/support/time_win32.c"
"src/core/support/time_win32.c",
"src/core/support/tls_pthread.c"
],
"secure": "no",
"vs_project_guid": "{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}"
@ -2134,7 +2137,7 @@
},
{
"name": "qps_driver",
"build": "tool",
"build": "benchmark",
"language": "c++",
"src": [
"test/cpp/qps/qps_driver.cc"
@ -2152,8 +2155,7 @@
},
{
"name": "qps_test",
"build": "test",
"run": false,
"build": "benchmark",
"language": "c++",
"src": [
"test/cpp/qps/qps_test.cc"
@ -2165,12 +2167,13 @@
"grpc++",
"grpc",
"gpr_test_util",
"gpr"
"gpr",
"grpc++_test_config"
]
},
{
"name": "qps_worker",
"build": "tool",
"build": "benchmark",
"language": "c++",
"headers": [
"test/cpp/qps/client.h",

@ -0,0 +1,65 @@
GRPC Connection Backoff Protocol
================================
When we do a connection to a backend which fails, it is typically desirable to
not retry immediately (to avoid flooding the network or the server with
requests) and instead do some form of exponential backoff.
We have several parameters:
1. INITIAL_BACKOFF (how long to wait after the first failure before retrying)
2. MULTIPLIER (factor with which to multiply backoff after a failed retry)
3. MAX_BACKOFF (Upper bound on backoff)
4. MIN_CONNECTION_TIMEOUT
## Proposed Backoff Algorithm
Exponentially back off the start time of connection attempts up to a limit of
MAX_BACKOFF.
```
ConnectWithBackoff()
current_backoff = INITIAL_BACKOFF
current_deadline = now() + INITIAL_BACKOFF
while (TryConnect(Max(current_deadline, MIN_CONNECT_TIMEOUT))
!= SUCCESS)
SleepUntil(current_deadline)
current_backoff = Min(current_backoff * MULTIPLIER, MAX_BACKOFF)
current_deadline = now() + current_backoff
```
## Historical Algorithm in Stubby
Exponentially increase up to a limit of MAX_BACKOFF the intervals between
connection attempts. This is what stubby 2 uses, and is equivalent if
TryConnect() fails instantly.
```
LegacyConnectWithBackoff()
current_backoff = INITIAL_BACKOFF
while (TryConnect(MIN_CONNECT_TIMEOUT) != SUCCESS)
SleepFor(current_backoff)
current_backoff = Min(current_backoff * MULTIPLIER, MAX_BACKOFF)
```
The grpc C implementation currently uses this approach with an initial backoff
of 1 second, multiplier of 2, and maximum backoff of 120 seconds. (This will
change)
Stubby, or at least rpc2, uses exactly this algorithm with an initial backoff
of 1 second, multiplier of 1.2, and a maximum backoff of 120 seconds.
## Use Cases to Consider
* Client tries to connect to a server which is down for multiple hours, eg for
maintenance
* Client tries to connect to a server which is overloaded
* User is bringing up both a client and a server at the same time
* In particular, we would like to avoid a large unnecessary delay if the
client connects to a server which is about to come up
* Client/server are misconfigured such that connection attempts always fail
* We want to make sure these don’t put too much load on the server by
default.
* Server is overloaded and wants to transiently make clients back off
* Application has out of band reason to believe a server is back
* We should consider an out of band mechanism for the client to hint that
we should short circuit the backoff.

@ -517,6 +517,28 @@ Procedure:
Asserts:
* Call completed with status CANCELLED
### timeout_on_sleeping_server
This test verifies that an RPC request whose lifetime exceeds its configured
timeout value will end with the DeadlineExceeded status.
Server features:
* [FullDuplexCall][]
Procedure:
1. Client calls FullDuplexCall with the following request and sets its timeout to 1ms.
```
{
payload:{
body: 27182 bytes of zeros
}
}
```
Asserts:
* Call completed with status DEADLINE_EXCEEDED.
### concurrent_large_unary
Status: TODO
@ -540,8 +562,6 @@ Cancel after sent headers (ctiller - done)
Cancel after received first message (ctiller - done)
Timeout after expire (zhaoq)
Zero-message streams (ejona)
Multiple thousand simultaneous calls on same Channel (ctiller - done)

@ -77,6 +77,7 @@
#define GPR_POSIX_ENV 1
#define GPR_POSIX_FILE 1
#define GPR_POSIX_STRING 1
#define GPR_POSIX_SUBPROCESS 1
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1
@ -122,6 +123,7 @@
#endif
#define GPR_POSIX_FILE 1
#define GPR_POSIX_STRING 1
#define GPR_POSIX_SUBPROCESS 1
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1
@ -154,6 +156,7 @@
#define GPR_POSIX_ENV 1
#define GPR_POSIX_FILE 1
#define GPR_POSIX_STRING 1
#define GPR_POSIX_SUBPROCESS 1
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1
@ -180,6 +183,7 @@
#define GPR_POSIX_ENV 1
#define GPR_POSIX_FILE 1
#define GPR_POSIX_STRING 1
#define GPR_POSIX_SUBPROCESS 1
#define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1

@ -0,0 +1,49 @@
/*
*
* 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.
*
*/
#ifndef GRPC_SUPPORT_SUBPROCESS_H
#define GRPC_SUPPORT_SUBPROCESS_H
typedef struct gpr_subprocess gpr_subprocess;
/* .exe on windows, empty on unices */
char *gpr_subprocess_binary_extension();
gpr_subprocess *gpr_subprocess_create(int argc, char **argv);
/* if subprocess has not been joined, kill it */
void gpr_subprocess_destroy(gpr_subprocess *p);
/* returns exit status; can be called at most once */
int gpr_subprocess_join(gpr_subprocess *p);
void gpr_subprocess_interrupt(gpr_subprocess *p);
#endif

@ -54,7 +54,7 @@
Destroying a thread local:
gpr_tls_destroy(&foo);
Setting a thread local:
Setting a thread local (returns new_value):
gpr_tls_set(&foo, new_value);
Accessing a thread local:

@ -34,6 +34,9 @@
#ifndef GRPC_SUPPORT_TLS_PTHREAD_H
#define GRPC_SUPPORT_TLS_PTHREAD_H
#include <grpc/support/log.h> /* for GPR_ASSERT */
#include <pthread.h>
/* Thread local storage based on pthread library calls.
#include tls.h to use this - and see that file for documentation */
@ -46,8 +49,7 @@ struct gpr_pthread_thread_local {
#define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL))
#define gpr_tls_destroy(tls) pthread_key_delete((tls)->key)
#define gpr_tls_set(tls, new_value) \
GPR_ASSERT(pthread_setspecific((tls)->key, (void*)(new_value)) == 0)
gpr_intptr gpr_tls_set(struct gpr_pthread_thread_local *tls, gpr_intptr value);
#define gpr_tls_get(tls) ((gpr_intptr)pthread_getspecific((tls)->key))
#endif

@ -81,6 +81,24 @@ static const char *ssl_cipher_suites(void) {
/* -- Common methods. -- */
/* Returns the first property with that name. */
static const tsi_peer_property *tsi_peer_get_property_by_name(
const tsi_peer *peer, const char *name) {
size_t i;
if (peer == NULL) return NULL;
for (i = 0; i < peer->property_count; i++) {
const tsi_peer_property* property = &peer->properties[i];
if (name == NULL && property->name == NULL) {
return property;
}
if (name != NULL && property->name != NULL &&
strcmp(property->name, name) == 0) {
return property;
}
}
return NULL;
}
grpc_security_status grpc_security_connector_create_handshaker(
grpc_security_connector *sc, tsi_handshaker **handshaker) {
if (sc == NULL || handshaker == NULL) return GRPC_SECURITY_ERROR;
@ -212,13 +230,8 @@ static grpc_security_status fake_check_peer(grpc_security_connector *sc,
status = GRPC_SECURITY_ERROR;
goto end;
}
if (peer.properties[0].type != TSI_PEER_PROPERTY_TYPE_STRING) {
gpr_log(GPR_ERROR, "Invalid type of cert type property.");
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.data, TSI_FAKE_CERTIFICATE_TYPE,
peer.properties[0].value.length)) {
gpr_log(GPR_ERROR, "Invalid value for cert type property.");
status = GRPC_SECURITY_ERROR;
goto end;
@ -365,12 +378,7 @@ static grpc_security_status ssl_check_peer(const char *peer_name,
gpr_log(GPR_ERROR, "Missing selected ALPN property.");
return GRPC_SECURITY_ERROR;
}
if (p->type != TSI_PEER_PROPERTY_TYPE_STRING) {
gpr_log(GPR_ERROR, "Invalid selected ALPN property.");
return GRPC_SECURITY_ERROR;
}
if (!grpc_chttp2_is_alpn_version_supported(p->value.string.data,
p->value.string.length)) {
if (!grpc_chttp2_is_alpn_version_supported(p->value.data, p->value.length)) {
gpr_log(GPR_ERROR, "Invalid ALPN value.");
return GRPC_SECURITY_ERROR;
}

@ -0,0 +1,108 @@
/*
*
* 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 <grpc/support/port_platform.h>
#ifdef GPR_POSIX_SUBPROCESS
#include <grpc/support/subprocess.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
struct gpr_subprocess {
int pid;
int joined;
};
char *gpr_subprocess_binary_extension() { return ""; }
gpr_subprocess *gpr_subprocess_create(int argc, char **argv) {
gpr_subprocess *r;
int pid;
char **exec_args;
pid = fork();
if (pid == -1) {
return NULL;
} else if (pid == 0) {
exec_args = gpr_malloc((argc + 1) * sizeof(char *));
memcpy(exec_args, argv, argc * sizeof(char *));
exec_args[argc] = NULL;
execv(exec_args[0], exec_args);
/* if we reach here, an error has occurred */
gpr_log(GPR_ERROR, "execv '%s' failed: %s", exec_args[0], strerror(errno));
_exit(1);
return NULL;
} else {
r = gpr_malloc(sizeof(gpr_subprocess));
memset(r, 0, sizeof(*r));
r->pid = pid;
return r;
}
}
void gpr_subprocess_destroy(gpr_subprocess *p) {
if (!p->joined) {
kill(p->pid, SIGKILL);
gpr_subprocess_join(p);
}
gpr_free(p);
}
int gpr_subprocess_join(gpr_subprocess *p) {
int status;
if (waitpid(p->pid, &status, 0) == -1) {
gpr_log(GPR_ERROR, "waitpid failed: %s", strerror(errno));
return -1;
}
return status;
}
void gpr_subprocess_interrupt(gpr_subprocess *p) {
if (!p->joined) {
kill(p->pid, SIGINT);
}
}
#endif /* GPR_POSIX_SUBPROCESS */

@ -0,0 +1,45 @@
/*
*
* 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 <grpc/support/port_platform.h>
#ifdef GPR_PTHREAD_TLS
#include <grpc/support/tls.h>
gpr_intptr gpr_tls_set(struct gpr_pthread_thread_local *tls, gpr_intptr value) {
GPR_ASSERT(0 == pthread_setspecific(tls->key, (void*)value));
return value;
}
#endif /* GPR_PTHREAD_TLS */

@ -269,31 +269,16 @@ static tsi_result peer_property_from_x509_common_name(
}
/* Gets the subject SANs from an X509 cert as a tsi_peer_property. */
static tsi_result peer_property_from_x509_subject_alt_names(
X509* cert, tsi_peer_property* property) {
int i = 0;
int subject_alt_name_count = 0;
static tsi_result add_subject_alt_names_properties_to_peer(
tsi_peer* peer, GENERAL_NAMES* subject_alt_names,
int subject_alt_name_count) {
int i;
tsi_result result = TSI_OK;
GENERAL_NAMES* subject_alt_names =
X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0);
if (subject_alt_names == NULL) {
/* Empty list. */
return tsi_construct_list_peer_property(
TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY, 0, property);
}
subject_alt_name_count = sk_GENERAL_NAME_num(subject_alt_names);
result = tsi_construct_list_peer_property(
TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY, subject_alt_name_count,
property);
if (result != TSI_OK) return result;
/* Reset for DNS entries filtering. */
subject_alt_name_count = property->value.list.child_count;
property->value.list.child_count = 0;
peer->property_count -= subject_alt_name_count;
for (i = 0; i < subject_alt_name_count; i++) {
tsi_peer_property* child_property = NULL;
GENERAL_NAME* subject_alt_name =
sk_GENERAL_NAME_value(subject_alt_names, i);
/* Filter out the non-dns entries names. */
@ -306,40 +291,50 @@ static tsi_result peer_property_from_x509_subject_alt_names(
result = TSI_INTERNAL_ERROR;
break;
}
child_property =
&property->value.list.children[property->value.list.child_count++];
result = tsi_construct_string_peer_property(
NULL, (const char*)dns_name, dns_name_size, child_property);
TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY,
(const char*)dns_name, dns_name_size,
&peer->properties[peer->property_count++]);
OPENSSL_free(dns_name);
if (result != TSI_OK) break;
}
}
if (result != TSI_OK) tsi_peer_property_destruct(property);
sk_GENERAL_NAME_pop_free(subject_alt_names, GENERAL_NAME_free);
return TSI_OK;
return result;
}
/* Gets information about the peer's X509 cert as a tsi_peer object. */
static tsi_result peer_from_x509(X509* cert, int include_certificate_type,
tsi_peer* peer) {
/* TODO(jboeuf): Maybe add more properties. */
size_t property_count = include_certificate_type ? 3 : 2;
GENERAL_NAMES* subject_alt_names =
X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0);
int subject_alt_name_count =
(subject_alt_names != NULL) ? sk_GENERAL_NAME_num(subject_alt_names) : 0;
size_t property_count = (include_certificate_type ? 1 : 0) +
1 /* common name */ + subject_alt_name_count;
tsi_result result = tsi_construct_peer(property_count, peer);
if (result != TSI_OK) return result;
do {
result = peer_property_from_x509_common_name(cert, &peer->properties[0]);
if (result != TSI_OK) break;
result =
peer_property_from_x509_subject_alt_names(cert, &peer->properties[1]);
if (result != TSI_OK) break;
if (include_certificate_type) {
result = tsi_construct_string_peer_property_from_cstring(
TSI_CERTIFICATE_TYPE_PEER_PROPERTY, TSI_X509_CERTIFICATE_TYPE,
&peer->properties[2]);
&peer->properties[0]);
if (result != TSI_OK) break;
}
result = peer_property_from_x509_common_name(
cert, &peer->properties[include_certificate_type ? 1 : 0]);
if (result != TSI_OK) break;
if (subject_alt_name_count != 0) {
result = add_subject_alt_names_properties_to_peer(peer, subject_alt_names,
subject_alt_name_count);
if (result != TSI_OK) break;
}
} while (0);
if (subject_alt_names != NULL) {
sk_GENERAL_NAME_pop_free(subject_alt_names, GENERAL_NAME_free);
}
if (result != TSI_OK) tsi_peer_destruct(peer);
return result;
}
@ -1345,43 +1340,32 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name) {
size_t i = 0;
size_t san_count = 0;
const tsi_peer_property* property = NULL;
const tsi_peer_property* cn_property = NULL;
/* For now reject what looks like an IP address. */
if (looks_like_ip_address(name)) return 0;
/* Check the SAN first. */
property = tsi_peer_get_property_by_name(
peer, TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY);
if (property == NULL || property->type != TSI_PEER_PROPERTY_TYPE_LIST) {
gpr_log(GPR_ERROR, "Invalid x509 subject alternative names property.");
return 0;
}
san_count = property->value.list.child_count;
for (i = 0; i < san_count; i++) {
const tsi_peer_property* alt_name_property =
&property->value.list.children[i];
if (alt_name_property->type != TSI_PEER_PROPERTY_TYPE_STRING) {
gpr_log(GPR_ERROR, "Invalid x509 subject alternative name property.");
return 0;
}
if (does_entry_match_name(alt_name_property->value.string.data,
alt_name_property->value.string.length, name)) {
return 1;
for (i = 0; i < peer->property_count; i++) {
const tsi_peer_property* property = &peer->properties[i];
if (property->name == NULL) continue;
if (strcmp(property->name,
TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY) == 0) {
san_count++;
if (does_entry_match_name(property->value.data, property->value.length,
name)) {
return 1;
}
} else if (strcmp(property->name,
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY) == 0) {
cn_property = property;
}
}
/* If there's no SAN, try the CN. */
if (san_count == 0) {
property = tsi_peer_get_property_by_name(
peer, TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY);
if (property == NULL || property->type != TSI_PEER_PROPERTY_TYPE_STRING) {
gpr_log(GPR_ERROR, "Invalid x509 subject common name property.");
return 0;
}
if (does_entry_match_name(property->value.string.data,
property->value.string.length, name)) {
if (san_count == 0 && cn_property != NULL) {
if (does_entry_match_name(cn_property->value.data,
cn_property->value.length, name)) {
return 1;
}
}

@ -45,13 +45,9 @@ extern "C" {
/* This property is of type TSI_PEER_PROPERTY_STRING. */
#define TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY "x509_subject_common_name"
#define TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY \
"x509_subject_alternative_name"
/* This property is of type TSI_PEER_PROPERTY_LIST and the children contain
unnamed (name == NULL) properties of type TSI_PEER_PROPERTY_STRING. */
#define TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY \
"x509_subject_alternative_names"
/* This property is of type TSI_PEER_PROPERTY_STRING. */
#define TSI_SSL_ALPN_SELECTED_PROTOCOL "ssl_alpn_selected_protocol"
/* --- tsi_ssl_handshaker_factory object ---

@ -198,23 +198,6 @@ void tsi_handshaker_destroy(tsi_handshaker* self) {
/* --- tsi_peer implementation. --- */
const tsi_peer_property* tsi_peer_get_property_by_name(const tsi_peer* self,
const char* name) {
size_t i;
if (self == NULL) return NULL;
for (i = 0; i < self->property_count; i++) {
const tsi_peer_property* property = &self->properties[i];
if (name == NULL && property->name == NULL) {
return property;
}
if (name != NULL && property->name != NULL &&
strcmp(property->name, name) == 0) {
return property;
}
}
return NULL;
}
tsi_peer_property tsi_init_peer_property(void) {
tsi_peer_property property;
memset(&property, 0, sizeof(tsi_peer_property));
@ -234,18 +217,8 @@ void tsi_peer_property_destruct(tsi_peer_property* property) {
if (property->name != NULL) {
free(property->name);
}
switch (property->type) {
case TSI_PEER_PROPERTY_TYPE_STRING:
if (property->value.string.data != NULL) {
free(property->value.string.data);
}
break;
case TSI_PEER_PROPERTY_TYPE_LIST:
tsi_peer_destroy_list_property(property->value.list.children,
property->value.list.child_count);
default:
/* Nothing to free. */
break;
if (property->value.data != NULL) {
free(property->value.data);
}
*property = tsi_init_peer_property(); /* Reset everything to 0. */
}
@ -259,57 +232,20 @@ void tsi_peer_destruct(tsi_peer* self) {
self->property_count = 0;
}
tsi_result tsi_construct_signed_integer_peer_property(
const char* name, int64_t value, tsi_peer_property* property) {
*property = tsi_init_peer_property();
property->type = TSI_PEER_PROPERTY_TYPE_SIGNED_INTEGER;
if (name != NULL) {
property->name = tsi_strdup(name);
if (property->name == NULL) return TSI_OUT_OF_RESOURCES;
}
property->value.signed_int = value;
return TSI_OK;
}
tsi_result tsi_construct_unsigned_integer_peer_property(
const char* name, uint64_t value, tsi_peer_property* property) {
*property = tsi_init_peer_property();
property->type = TSI_PEER_PROPERTY_TYPE_UNSIGNED_INTEGER;
if (name != NULL) {
property->name = tsi_strdup(name);
if (property->name == NULL) return TSI_OUT_OF_RESOURCES;
}
property->value.unsigned_int = value;
return TSI_OK;
}
tsi_result tsi_construct_real_peer_property(const char* name, double value,
tsi_peer_property* property) {
*property = tsi_init_peer_property();
property->type = TSI_PEER_PROPERTY_TYPE_REAL;
if (name != NULL) {
property->name = tsi_strdup(name);
if (property->name == NULL) return TSI_OUT_OF_RESOURCES;
}
property->value.real = value;
return TSI_OK;
}
tsi_result tsi_construct_allocated_string_peer_property(
const char* name, size_t value_length, tsi_peer_property* property) {
*property = tsi_init_peer_property();
property->type = TSI_PEER_PROPERTY_TYPE_STRING;
if (name != NULL) {
property->name = tsi_strdup(name);
if (property->name == NULL) return TSI_OUT_OF_RESOURCES;
}
if (value_length > 0) {
property->value.string.data = calloc(1, value_length);
if (property->value.string.data == NULL) {
property->value.data = calloc(1, value_length);
if (property->value.data == NULL) {
tsi_peer_property_destruct(property);
return TSI_OUT_OF_RESOURCES;
}
property->value.string.length = value_length;
property->value.length = value_length;
}
return TSI_OK;
}
@ -328,28 +264,7 @@ tsi_result tsi_construct_string_peer_property(const char* name,
name, value_length, property);
if (result != TSI_OK) return result;
if (value_length > 0) {
memcpy(property->value.string.data, value, value_length);
}
return TSI_OK;
}
tsi_result tsi_construct_list_peer_property(const char* name,
size_t child_count,
tsi_peer_property* property) {
*property = tsi_init_peer_property();
property->type = TSI_PEER_PROPERTY_TYPE_LIST;
if (name != NULL) {
property->name = tsi_strdup(name);
if (property->name == NULL) return TSI_OUT_OF_RESOURCES;
}
if (child_count > 0) {
property->value.list.children =
calloc(child_count, sizeof(tsi_peer_property));
if (property->value.list.children == NULL) {
tsi_peer_property_destruct(property);
return TSI_OUT_OF_RESOURCES;
}
property->value.list.child_count = child_count;
memcpy(property->value.data, value, value_length);
}
return TSI_OK;
}

@ -92,12 +92,6 @@ struct tsi_handshaker {
tsi_result tsi_construct_peer(size_t property_count, tsi_peer* peer);
tsi_peer_property tsi_init_peer_property(void);
void tsi_peer_property_destruct(tsi_peer_property* property);
tsi_result tsi_construct_signed_integer_peer_property(
const char* name, int64_t value, tsi_peer_property* property);
tsi_result tsi_construct_unsigned_integer_peer_property(
const char* name, uint64_t value, tsi_peer_property* property);
tsi_result tsi_construct_real_peer_property(const char* name, double value,
tsi_peer_property* property);
tsi_result tsi_construct_string_peer_property(const char* name,
const char* value,
size_t value_length,
@ -106,9 +100,6 @@ tsi_result tsi_construct_allocated_string_peer_property(
const char* name, size_t value_length, tsi_peer_property* property);
tsi_result tsi_construct_string_peer_property_from_cstring(
const char* name, const char* value, tsi_peer_property* property);
tsi_result tsi_construct_list_peer_property(const char* name,
size_t child_count,
tsi_peer_property* property);
/* Utils. */
char* tsi_strdup(const char* src); /* Sadly, no strdup in C89. */

@ -179,33 +179,13 @@ void tsi_frame_protector_destroy(tsi_frame_protector* self);
/* This property is of type TSI_PEER_PROPERTY_STRING. */
#define TSI_CERTIFICATE_TYPE_PEER_PROPERTY "certificate_type"
/* Properties of type TSI_PEER_PROPERTY_TYPE_STRING may contain NULL characters
just like C++ strings. The length field gives the length of the string. */
typedef enum {
TSI_PEER_PROPERTY_TYPE_SIGNED_INTEGER,
TSI_PEER_PROPERTY_TYPE_UNSIGNED_INTEGER,
TSI_PEER_PROPERTY_TYPE_REAL,
TSI_PEER_PROPERTY_TYPE_STRING,
TSI_PEER_PROPERTY_TYPE_LIST
} tsi_peer_property_type;
/* The relevant field in the union value is dictated by the type field.
name may be NULL in case of an unnamed property. */
/* Property values may contain NULL characters just like C++ strings.
The length field gives the length of the string. */
typedef struct tsi_peer_property {
char* name;
tsi_peer_property_type type;
union {
int64_t signed_int;
uint64_t unsigned_int;
double real;
struct {
char* data;
size_t length;
} string;
struct {
struct tsi_peer_property* children;
size_t child_count;
} list;
struct {
char* data;
size_t length;
} value;
} tsi_peer_property;
@ -214,13 +194,6 @@ typedef struct {
size_t property_count;
} tsi_peer;
/* Gets the first property with the specified name. Iteration over the
properties of the peer should be used if the client of the API is expecting
several properties with the same name.
Returns NULL if there is no corresponding property. */
const tsi_peer_property* tsi_peer_get_property_by_name(const tsi_peer* self,
const char* name);
/* Destructs the tsi_peer object. */
void tsi_peer_destruct(tsi_peer* self);

@ -5,3 +5,4 @@ test-results
packages
Grpc.v12.suo
TestResult.xml
*.nupkg

@ -1 +0,0 @@
gRPC C# is work-in-progress and is not intended to be used. See README.

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>Grpc.Auth</id>
<title>gRPC C# Auth</title>
<summary>Auth library for C# implementation of gRPC - an RPC library and framework</summary>
<description>Auth library for C# implementation of gRPC - an RPC library and framework. See project site for more info.</description>
<version>0.5.0</version>
<authors>Google Inc.</authors>
<owners>jtattermusch</owners>
<licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/grpc/grpc</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>Release 0.5.0 of gRPC C#</releaseNotes>
<copyright>Copyright 2015, Google Inc.</copyright>
<tags>gRPC RPC Protocol HTTP/2 Auth OAuth2</tags>
<dependencies>
<dependency id="BouncyCastle" version="1.7.0" />
<dependency id="Google.Apis.Auth" version="1.9.1" />
<dependency id="Grpc.Core" version="0.5.0" />
</dependencies>
</metadata>
<files>
<file src="bin/Release/Grpc.Auth.dll" target="lib/net45" />
</files>
</package>

@ -9,6 +9,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]
[assembly: InternalsVisibleTo("Grpc.Auth.Tests")]
[assembly: InternalsVisibleTo("Grpc.Auth.Tests")]

@ -9,4 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]

@ -1,3 +1,2 @@
bin
obj
*.nupkg

@ -2,23 +2,21 @@
<package>
<metadata>
<id>Grpc.Core</id>
<title>gRPC Core</title>
<title>gRPC C# Core</title>
<summary>Core C# implementation of gRPC - an RPC library and framework</summary>
<description>Core C# implementation of gRPC - an RPC library and framework. See project site for more info.
This is an experimental release, not ready to use.
</description>
<version>0.2.1</version>
<description>Core C# implementation of gRPC - an RPC library and framework. See project site for more info.</description>
<version>0.5.0</version>
<authors>Google Inc.</authors>
<owners>jtattermusch</owners>
<licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/grpc/grpc</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>The first experimental release. Not ready to use.</releaseNotes>
<releaseNotes>Release 0.5.0 of gRPC C#</releaseNotes>
<copyright>Copyright 2015, Google Inc.</copyright>
<tags>gRPC RPC Protocol HTTP/2</tags>
<dependencies>
<dependency id="Microsoft.Bcl.Immutable" version="1.0.34" />
<dependency id="grpc.native.csharp_ext" version="0.6.0.0" />
<dependency id="grpc.native.csharp_ext" version="0.8.0.0" />
</dependencies>
</metadata>
<files>

@ -9,6 +9,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]
[assembly: InternalsVisibleTo("Grpc.Core.Tests")]

@ -9,4 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]

@ -9,4 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyVersion("0.5.*")]

@ -9,4 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]

@ -9,4 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]

@ -9,4 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]

@ -9,4 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]

@ -9,4 +9,4 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCopyright("Google Inc. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyVersion("0.5.*")]

@ -1,23 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<package >
<package>
<metadata>
<id>Grpc</id>
<title>gRPC</title>
<summary>C# implementation of gRPC - an RPC library and framework</summary>
<description>C# implementation of gRPC - an RPC library and framework. See project site for more info.
This is an experimental release, not ready to use.
</description>
<version>0.2.0</version>
<description>C# implementation of gRPC - an RPC library and framework. See project site for more info.</description>
<version>0.5.0</version>
<authors>Google Inc.</authors>
<owners>jtattermusch</owners>
<licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/grpc/grpc</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>The first experimental release. Not ready to use.</releaseNotes>
<releaseNotes>Release 0.5.0 of gRPC C#</releaseNotes>
<copyright>Copyright 2015, Google Inc.</copyright>
<tags>gRPC RPC Protocol HTTP/2</tags>
<dependencies>
<dependency id="Grpc.Core" version="0.2.0" />
<dependency id="Grpc.Core" version="0.5.0" />
</dependencies>
</metadata>
<files/>
</package>

@ -4,74 +4,117 @@ gRPC C#
A C# implementation of gRPC.
Status
-----------------
------
**This gRPC C# implementation is work-in-progress and is not expected to work yet.**
Ready for early adopters.
- The implementation is a wrapper around gRPC C core library
- Code only runs under mono currently, building gRPC C core library under Windows
is in progress.
- It is very possible that some parts of the code will be heavily refactored or
completely rewritten.
Usage: Windows
--------------
- Prerequisites: .NET Framework 4.5+, Visual Studio 2013 with NuGet extension installed (VS2015 should work).
INSTALLATION AND USAGE: WINDOWS
-------------------------------
- Open Visual Studio and start a new project/solution.
- Open Grpc.sln using Visual Studio 2013. NuGet dependencies will be restored
upon build.
- Add NuGet package `Grpc` as a dependency (Project options -> Manage NuGet Packages).
That will also pull all the transitive dependencies (including the native libraries that
gRPC C# is internally using).
- TODO: link to Helloworld example
INSTALLATION AND USAGE: LINUX & MONO
------------------------------------
Usage: Linux (Mono)
--------------
- Compile and install the gRPC C# extension library (that will be used via
P/Invoke from C#).
- Prerequisites: Mono framework, MonoDevelop 5.9 with NuGet add-in installed.
- Install gRPC C Core using instructions in https://github.com/grpc/homebrew-grpc
- TODO: explain using LD_LIBRARY_PATH or installation to /usr/local
- Open MonoDevelop and start a new project/solution.
- Add NuGet package `Grpc` as a dependency (Project -> Add NuGet packages).
- TODO: link to Helloworld example
Building: Windows
-----------------
You only need to go through these steps if you are planning to develop gRPC C#.
If you are a user of gRPC C#, go to Usage section above.
- Prerequisites for development: NET Framework 4.5+, Visual Studio 2013 (with NuGet and NUnit extensions installed).
- The grpc_csharp_ext native library needs to be built so you can build the Grpc C# solution. You can
either build the native solution in `vsprojects/grpc.sln` from Visual Studio manually, or you can use
a convenience batch script that builds everything for you.
```
make grpc_csharp_ext
sudo make install_grpc_csharp_ext
buildall.bat
```
- Prerequisites for development: Mono framework, MonoDevelop (IDE)
- Open Grpc.sln using Visual Studio 2013. NuGet dependencies will be restored
upon build (you need to have NuGet add-in installed).
Building: Linux & Mono
----------------------
You only need to go through these steps if you are planning to develop gRPC C#.
If you are a user of gRPC C#, go to Usage section above.
- Prerequisites for development: Mono framework, MonoDevelop 5.9 with NuGet and Nunit add-ins installed.
```
sudo apt-get install mono-devel
sudo apt-get install monodevelop monodevelop-nunit
sudo apt-get install nunit nunit-console
```
- NuGet is used to manage project's dependencies. Prior opening Grpc.sln,
download dependencies using NuGet restore command:
You can use older versions of MonoDevelop, but then you might need to restore
NuGet dependencies manually (by `nuget restore`), because older versions of MonoDevelop
don't support NuGet add-in.
- Compile and install the gRPC C# extension library (that will be used via
P/Invoke from C#).
```
# Import needed certicates into Mono certificate store:
mozroots --import --sync
# Download NuGet.exe http://nuget.codeplex.com/releases/
# Restore the nuget packages with Grpc C# dependencies
mono ~/Downloads/NuGet.exe restore Grpc.sln
make grpc_csharp_ext
sudo make install_grpc_csharp_ext
```
- Use MonoDevelop to open the solution Grpc.sln (you can also run unit tests
from there).
- Use MonoDevelop to open the solution Grpc.sln
- Build the solution & run all the tests from test view.
Tests
-----
- After building the solution with MonoDevelop, you can use
nunit-console to run the unit tests (currently only running one by
one will make them pass.
gRPC C# is using NUnit as the testing framework.
Under Visual Studio, make sure NUnit test adapter is installed (under "Extensions and Updates").
Then you should be able to run all the tests using Test Explorer.
Under Monodevelop, make sure you installed "NUnit support" in Add-in manager.
Then you should be able to run all the test from the Test View.
After building the solution, you can also run the tests from command line
using nunit-console tool.
```
# from Grpc.Core.Test/bin/Debug directory
nunit-console Grpc.Core.Tests.dll
```
CONTENTS
Contents
--------
- ext:
The extension library that wraps C API to be more digestible by C#.
- Grpc.Auth:
gRPC OAuth2 support.
- Grpc.Core:
The main gRPC C# library.
- Grpc.Examples:
API examples for math.proto
- Grpc.Examples.MathClient:
An example client that sends some requests to math server.
- Grpc.Examples.MathServer:
An example client that sends some requests to math server.
- Grpc.IntegrationTesting:
Client for cross-language gRPC implementation testing (interop testing).
Cross-language gRPC implementation testing (interop testing).

@ -0,0 +1,16 @@
@rem Builds NuGet packages
@rem Adjust the location of nuget.exe
set NUGET=C:\nuget\nuget.exe
@call buildall.bat || goto :error
%NUGET% pack Grpc.Core\Grpc.Core.nuspec || goto :error
%NUGET% pack Grpc.Auth\Grpc.Auth.nuspec || goto :error
%NUGET% pack Grpc.nuspec || goto :error
goto :EOF
:error
echo Failed!
exit /b %errorlevel%

@ -0,0 +1,18 @@
@rem Convenience script to build gRPC C# from command line
setlocal
@rem Set VS variables (uses Visual Studio 2013)
@call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86
@rem Build the C# native extension
msbuild ..\..\vsprojects\grpc.sln /t:grpc_csharp_ext || goto :error
msbuild Grpc.sln /p:Configuration=Debug || goto :error
msbuild Grpc.sln /p:Configuration=Release || goto :error
endlocal
goto :EOF
:error
echo Failed!
exit /b %errorlevel%

@ -263,6 +263,19 @@ function cancelAfterFirstResponse(client, done) {
});
}
function timeoutOnSleepingServer(client, done) {
var deadline = new Date();
deadline.setMilliseconds(deadline.getMilliseconds() + 1);
var call = client.fullDuplexCall(null, deadline);
call.write({
payload: {body: zeroBuffer(27182)}
});
call.on('error', function(error) {
assert.strictEqual(error.code, grpc.status.DEADLINE_EXCEEDED);
done();
});
}
/**
* Run one of the authentication tests.
* @param {string} expected_user The expected username in the response
@ -271,7 +284,7 @@ function cancelAfterFirstResponse(client, done) {
* @param {function} done Callback to call when the test is completed. Included
* primarily for use with mocha
*/
function authTest(expected_user, client, scope, done) {
function authTest(expected_user, scope, client, done) {
(new GoogleAuth()).getApplicationDefault(function(err, credential) {
assert.ifError(err);
if (credential.createScopedRequired() && scope) {
@ -315,6 +328,7 @@ var test_cases = {
empty_stream: emptyStream,
cancel_after_begin: cancelAfterBegin,
cancel_after_first_response: cancelAfterFirstResponse,
timeout_on_sleeping_server: timeoutOnSleepingServer,
compute_engine_creds: _.partial(authTest, COMPUTE_ENGINE_USER, null),
service_account_creds: _.partial(authTest, AUTH_USER, AUTH_SCOPE),
jwt_token_creds: _.partial(authTest, AUTH_USER, null)

@ -223,7 +223,7 @@ function makeUnaryRequestFunction(method, serialize, deserialize) {
emitter.cancel = function cancel() {
call.cancel();
};
this.updateMetadata(metadata, function(error, metadata) {
this.updateMetadata(this.auth_uri, metadata, function(error, metadata) {
if (error) {
call.cancel();
callback(error);
@ -289,7 +289,7 @@ function makeClientStreamRequestFunction(method, serialize, deserialize) {
metadata = {};
}
var stream = new ClientWritableStream(call, serialize);
this.updateMetadata(metadata, function(error, metadata) {
this.updateMetadata(this.auth_uri, metadata, function(error, metadata) {
if (error) {
call.cancel();
callback(error);
@ -360,7 +360,7 @@ function makeServerStreamRequestFunction(method, serialize, deserialize) {
metadata = {};
}
var stream = new ClientReadableStream(call, deserialize);
this.updateMetadata(metadata, function(error, metadata) {
this.updateMetadata(this.auth_uri, metadata, function(error, metadata) {
if (error) {
call.cancel();
stream.emit('error', error);
@ -427,7 +427,7 @@ function makeBidiStreamRequestFunction(method, serialize, deserialize) {
metadata = {};
}
var stream = new ClientDuplexStream(call, serialize, deserialize);
this.updateMetadata(metadata, function(error, metadata) {
this.updateMetadata(this.auth_uri, metadata, function(error, metadata) {
if (error) {
call.cancel();
stream.emit('error', error);
@ -503,10 +503,11 @@ function makeClientConstructor(methods, serviceName) {
callback(null, metadata);
};
}
this.server_address = address.replace(/\/$/, '');
this.channel = new grpc.Channel(address, options);
this.updateMetadata = _.partial(updateMetadata,
this.server_address + '/' + serviceName);
this.auth_uri = this.server_address + '/' + serviceName;
this.updateMetadata = updateMetadata;
}
_.each(methods, function(attrs, name) {

@ -86,4 +86,8 @@ describe('Interop tests', function() {
interop_client.runTest(port, name_override, 'cancel_after_first_response',
true, true, done);
});
it('should pass timeout_on_sleeping_server', function(done) {
interop_client.runTest(port, name_override, 'timeout_on_sleeping_server',
true, true, done);
});
});

@ -41,8 +41,18 @@
@implementation GRPCChannel
+ (instancetype)channelToHost:(NSString *)host {
// TODO(jcanizales): Reuse channels.
return [[self alloc] initWithHost:host];
// TODO(mlumish): Investigate whether a cache with strong links is a good idea
static NSMutableDictionary *channelCache;
static dispatch_once_t cacheInitialization;
dispatch_once(&cacheInitialization, ^{
channelCache = [NSMutableDictionary dictionary];
});
GRPCChannel *channel = channelCache[host];
if (!channel) {
channel = [[self alloc] initWithHost:host];
channelCache[host] = channel;
}
return channel;
}
- (instancetype)init {

@ -31,9 +31,12 @@
*
*/
#include <grpc/status.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import <gRPC/ProtoRPC.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <RemoteTest/Messages.pb.h>
#import <RemoteTest/Test.pb.h>
@ -69,7 +72,7 @@
}
- (void)testLargeUnaryRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyUnary"];
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"LargeUnary"];
RMTSimpleRequest *request = [[[[[[RMTSimpleRequestBuilder alloc] init]
setResponseType:RMTPayloadTypeCompressable]
@ -95,7 +98,7 @@
}
- (void)testClientStreamingRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyUnary"];
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ClientStreaming"];
id request1 = [[[[RMTStreamingInputCallRequestBuilder alloc] init]
setPayloadBuilder:[[[RMTPayloadBuilder alloc] init]
@ -130,4 +133,60 @@
[self waitForExpectationsWithTimeout:4. handler:nil];
}
- (void)testServerStreamingRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ServerStreaming"];
NSArray *expectedSizes = @[@31415, @9, @2653, @58979];
__block int index = 0;
id request = [[[[[[[RMTStreamingOutputCallRequestBuilder alloc] init]
addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
setSize:31415] build]]
addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
setSize:9] build]]
addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
setSize:2653] build]]
addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
setSize:58979] build]]
build];
[_service streamingOutputCallWithRequest:request handler:^(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error){
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
id expectedResponseBuilder = [[RMTStreamingOutputCallResponseBuilder alloc] init];
id expectedPayload = [[[[[RMTPayloadBuilder alloc] init]
setType:RMTPayloadTypeCompressable]
setBody:[NSMutableData dataWithLength:[expectedSizes[index] unsignedIntegerValue]]]
build];
expectedResponseBuilder = [expectedResponseBuilder setPayload:expectedPayload];
id expectedResponse = [expectedResponseBuilder build];
XCTAssertEqualObjects(response, expectedResponse);
[expectation fulfill];
index += 1;
}];
[self waitForExpectationsWithTimeout:4 handler:nil];
}
- (void)testEmptyStreamRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyStream"];
[_service fullDuplexCallWithRequestsWriter:[GRXWriter emptyWriter]
handler:^(bool done, RMTStreamingOutputCallResponse *response, NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error);
XCTAssert(done, @"Unexpected response: %@", response);
[expectation fulfill];
}];
[self waitForExpectationsWithTimeout:4 handler:nil];
}
- (void)testCancelAfterBeginRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"CancelAfterBegin"];
// TODO(mlumish): change to writing that blocks instead of writing
ProtoRPC *call = [_service RPCToStreamingInputCallWithRequestsWriter:[GRXWriter emptyWriter]
handler:^(RMTStreamingInputCallResponse *response, NSError *error) {
XCTAssertEqual([error code], GRPC_STATUS_CANCELLED);
[expectation fulfill];
}];
[call start];
[call cancel];
[self waitForExpectationsWithTimeout:1 handler:nil];
}
@end

@ -32,7 +32,7 @@
set +e
cd $(dirname $0)
module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || echo '../ext/grpc/modules'`
module_dir=../ext/grpc/modules
php -d extension_dir=$module_dir -d extension=grpc.so \
../tests/interop/interop_client.php $@ 1>&2

@ -34,7 +34,7 @@ set -e
cd $(dirname $0)
default_extension_dir=`php -i | grep extension_dir | sed 's/.*=> //g'`
module_dir=`php --version | grep -q 'PHP 5.6' && echo '../ext/grpc' || echo '../ext/grpc/modules'`
module_dir=../ext/grpc/modules
# sym-link in system supplied extensions
for f in $default_extension_dir/*.so

@ -52,6 +52,7 @@
#include <grpc/support/alloc.h>
#include <grpc/grpc.h>
#include "completion_queue.h"
#include "timeval.h"
#include "channel.h"
#include "byte_buffer.h"
@ -62,13 +63,6 @@ zend_class_entry *grpc_ce_call;
void free_wrapped_grpc_call(void *object TSRMLS_DC) {
wrapped_grpc_call *call = (wrapped_grpc_call *)object;
if (call->owned && call->wrapped != NULL) {
if (call->queue != NULL) {
grpc_completion_queue_shutdown(call->queue);
while (grpc_completion_queue_next(call->queue, gpr_inf_future).type !=
GRPC_QUEUE_SHUTDOWN)
;
grpc_completion_queue_destroy(call->queue);
}
grpc_call_destroy(call->wrapped);
}
efree(call);
@ -95,15 +89,13 @@ zend_object_value create_wrapped_grpc_call(zend_class_entry *class_type
/* Wraps a grpc_call struct in a PHP object. Owned indicates whether the struct
should be destroyed at the end of the object's lifecycle */
zval *grpc_php_wrap_call(grpc_call *wrapped, grpc_completion_queue *queue,
bool owned) {
zval *grpc_php_wrap_call(grpc_call *wrapped, bool owned) {
zval *call_object;
MAKE_STD_ZVAL(call_object);
object_init_ex(call_object, grpc_ce_call);
wrapped_grpc_call *call =
(wrapped_grpc_call *)zend_object_store_get_object(call_object TSRMLS_CC);
call->wrapped = wrapped;
call->queue = queue;
return call_object;
}
@ -247,9 +239,8 @@ PHP_METHOD(Call, __construct) {
wrapped_grpc_timeval *deadline =
(wrapped_grpc_timeval *)zend_object_store_get_object(
deadline_obj TSRMLS_CC);
call->queue = grpc_completion_queue_create();
call->wrapped = grpc_channel_create_call(
channel->wrapped, call->queue, method, channel->target,
channel->wrapped, completion_queue, method, channel->target,
deadline->wrapped);
}
@ -415,7 +406,7 @@ PHP_METHOD(Call, startBatch) {
(long)error TSRMLS_CC);
goto cleanup;
}
event = grpc_completion_queue_pluck(call->queue, call->wrapped,
event = grpc_completion_queue_pluck(completion_queue, call->wrapped,
gpr_inf_future);
if (!event.success) {
zend_throw_exception(spl_ce_LogicException,

@ -54,15 +54,13 @@ typedef struct wrapped_grpc_call {
bool owned;
grpc_call *wrapped;
grpc_completion_queue *queue;
} wrapped_grpc_call;
/* Initializes the Call PHP class */
void grpc_init_call(TSRMLS_D);
/* Creates a Call object that wraps the given grpc_call struct */
zval *grpc_php_wrap_call(grpc_call *wrapped, grpc_completion_queue *queue,
bool owned);
zval *grpc_php_wrap_call(grpc_call *wrapped, bool owned);
/* Creates and returns a PHP associative array of metadata from a C array of
* call metadata */

@ -0,0 +1,50 @@
/*
*
* 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 "completion_queue.h"
#include <php.h>
grpc_completion_queue *completion_queue;
void grpc_php_init_completion_queue(TSRMLS_D) {
completion_queue = grpc_completion_queue_create();
}
void grpc_php_shutdown_completion_queue(TSRMLS_D) {
grpc_completion_queue_shutdown(completion_queue);
while (grpc_completion_queue_next(completion_queue, gpr_inf_future).type !=
GRPC_QUEUE_SHUTDOWN)
;
grpc_completion_queue_destroy(completion_queue);
}

@ -0,0 +1,50 @@
/*
*
* 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.
*
*/
#ifndef GRPC_PHP_GRPC_COMPLETION_QUEUE_H_
#define GRPC_PHP_GRPC_COMPLETION_QUEUE_H_
#include <php.h>
#include <grpc/grpc.h>
/* The global completion queue for all operations */
extern grpc_completion_queue *completion_queue;
/* Initializes the completion queue */
void grpc_php_init_completion_queue(TSRMLS_D);
/* Shut down the completion queue */
void grpc_php_shutdown_completion_queue(TSRMLS_D);
#endif /* GRPC_PHP_GRPC_COMPLETION_QUEUE_H_ */

@ -66,5 +66,5 @@ if test "$PHP_GRPC" != "no"; then
PHP_SUBST(GRPC_SHARED_LIBADD)
PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -std=c11)
PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c completion_queue.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -std=c11)
fi

@ -37,6 +37,7 @@
#include "timeval.h"
#include "credentials.h"
#include "server_credentials.h"
#include "completion_queue.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -188,6 +189,7 @@ PHP_MINIT_FUNCTION(grpc) {
grpc_init_timeval(TSRMLS_C);
grpc_init_credentials(TSRMLS_C);
grpc_init_server_credentials(TSRMLS_C);
grpc_php_init_completion_queue(TSRMLS_C);
return SUCCESS;
}
/* }}} */
@ -199,6 +201,7 @@ PHP_MSHUTDOWN_FUNCTION(grpc) {
UNREGISTER_INI_ENTRIES();
*/
grpc_shutdown_timeval(TSRMLS_C);
grpc_php_shutdown_completion_queue(TSRMLS_C);
grpc_shutdown();
return SUCCESS;
}

@ -51,6 +51,7 @@
#include <grpc/support/log.h>
#include <grpc/grpc_security.h>
#include "completion_queue.h"
#include "server.h"
#include "channel.h"
#include "server_credentials.h"
@ -61,13 +62,6 @@ zend_class_entry *grpc_ce_server;
/* Frees and destroys an instance of wrapped_grpc_server */
void free_wrapped_grpc_server(void *object TSRMLS_DC) {
wrapped_grpc_server *server = (wrapped_grpc_server *)object;
if (server->queue != NULL) {
grpc_completion_queue_shutdown(server->queue);
while (grpc_completion_queue_next(server->queue, gpr_inf_future).type !=
GRPC_QUEUE_SHUTDOWN)
;
grpc_completion_queue_destroy(server->queue);
}
if (server->wrapped != NULL) {
grpc_server_shutdown(server->wrapped);
grpc_server_destroy(server->wrapped);
@ -96,7 +90,6 @@ zend_object_value create_wrapped_grpc_server(zend_class_entry *class_type
/**
* Constructs a new instance of the Server class
* @param CompletionQueue $queue The completion queue to use with the server
* @param array $args The arguments to pass to the server (optional)
*/
PHP_METHOD(Server, __construct) {
@ -112,7 +105,6 @@ PHP_METHOD(Server, __construct) {
1 TSRMLS_CC);
return;
}
server->queue = grpc_completion_queue_create();
if (args_array == NULL) {
server->wrapped = grpc_server_create(NULL);
} else {
@ -120,7 +112,7 @@ PHP_METHOD(Server, __construct) {
server->wrapped = grpc_server_create(&args);
efree(args.args);
}
grpc_server_register_completion_queue(server->wrapped, server->queue);
grpc_server_register_completion_queue(server->wrapped, completion_queue);
}
/**
@ -144,21 +136,20 @@ PHP_METHOD(Server, requestCall) {
grpc_metadata_array_init(&metadata);
error_code =
grpc_server_request_call(server->wrapped, &call, &details, &metadata,
server->queue, server->queue, NULL);
completion_queue, completion_queue, NULL);
if (error_code != GRPC_CALL_OK) {
zend_throw_exception(spl_ce_LogicException, "request_call failed",
(long)error_code TSRMLS_CC);
goto cleanup;
}
event = grpc_completion_queue_pluck(server->queue, NULL, gpr_inf_future);
event = grpc_completion_queue_pluck(completion_queue, NULL, gpr_inf_future);
if (!event.success) {
zend_throw_exception(spl_ce_LogicException,
"Failed to request a call for some reason",
1 TSRMLS_CC);
goto cleanup;
}
add_property_zval(result, "call", grpc_php_wrap_call(call, server->queue,
true));
add_property_zval(result, "call", grpc_php_wrap_call(call, true));
add_property_string(result, "method", details.method, true);
add_property_string(result, "host", details.host, true);
add_property_zval(result, "absolute_deadline",

@ -53,7 +53,6 @@ typedef struct wrapped_grpc_server {
zend_object std;
grpc_server *wrapped;
grpc_completion_queue *queue;
} wrapped_grpc_server;
/* Initializes the Server class */

@ -28,30 +28,30 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
syntax = "proto2";
package math;
message DivArgs {
optional int64 dividend = 1;
optional int64 divisor = 2;
optional int64 dividend = 1 [default = 0];
optional int64 divisor = 2 [default = 0];
}
message DivReply {
optional int64 quotient = 1;
optional int64 remainder = 2;
optional int64 quotient = 1 [default = 0];
optional int64 remainder = 2 [default = 0];
}
message FibArgs {
optional int64 limit = 1;
optional int64 limit = 1 [default = 0];
}
message Num {
optional int64 num = 1;
optional int64 num = 1 [default = 0];
}
message FibReply {
optional int64 count = 1;
optional int64 count = 1 [default = 0];
}
service Math {

@ -33,25 +33,25 @@ syntax = "proto3";
package math;
message DivArgs {
optional int64 dividend = 1;
optional int64 divisor = 2;
int64 dividend = 1;
int64 divisor = 2;
}
message DivReply {
optional int64 quotient = 1;
optional int64 remainder = 2;
int64 quotient = 1;
int64 remainder = 2;
}
message FibArgs {
optional int64 limit = 1;
int64 limit = 1;
}
message Num {
optional int64 num = 1;
int64 num = 1;
}
message FibReply {
optional int64 count = 1;
int64 count = 1;
}
service Math {

@ -1369,6 +1369,8 @@ $(${tgt.name.upper()}_OBJS)\
% endif
% if tgt.language == 'c++' and tgt.build == 'test':
$(GTEST_LIB)\
% elif tgt.language == 'c++' and tgt.build == 'benchmark':
$(GTEST_LIB)\
% endif
-o $(BINDIR)/$(CONFIG)/${tgt.name}
% if tgt.build == 'protoc' or tgt.language == 'c++':

@ -75,6 +75,7 @@ END2END_TESTS = {
'ping_pong_streaming': default_test_options,
'registered_call': default_test_options,
'request_response_with_binary_metadata_and_payload': default_test_options,
'request_response_with_trailing_metadata_and_payload': default_test_options,
'request_response_with_metadata_and_payload': default_test_options,
'request_response_with_payload': default_test_options,
'request_response_with_payload_and_call_creds': TestOptions(flaky=False, secure=True),

@ -164,14 +164,9 @@ static void test_request_response_with_metadata_and_payload(
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s,
&call_details,
&request_metadata_recv,
<<<<<<< HEAD
f.server_cq, tag(101)));
cq_expect_completion(v_server, tag(101), 1);
=======
f.server_cq, f.server_cq,
tag(101)));
cq_expect_completion(v_server, tag(101), GRPC_OP_OK);
>>>>>>> a468c36601dd5997580129bbd66b5ebed02521f8
cq_expect_completion(v_server, tag(101), 1);
cq_verify(v_server);
op = ops;

@ -31,20 +31,11 @@
*
*/
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#endif
#include <unistd.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <grpc/support/alloc.h>
#include <grpc/support/subprocess.h>
#include <grpc/support/host_port.h>
#include "src/core/support/string.h"
#include "test/core/util/port.h"
@ -56,10 +47,7 @@ int main(int argc, char **argv) {
int port = grpc_pick_unused_port_or_die();
char *args[10];
int status;
pid_t svr, cli;
/* seed rng with pid, so we don't end up with the same random numbers as a
concurrently running test binary */
srand(getpid());
gpr_subprocess *svr, *cli;
/* figure out where we are */
if (lslash) {
memcpy(root, me, lslash - me);
@ -68,45 +56,36 @@ int main(int argc, char **argv) {
strcpy(root, ".");
}
/* start the server */
svr = fork();
if (svr == 0) {
gpr_asprintf(&args[0], "%s/fling_server", root);
args[1] = "--bind";
gpr_join_host_port(&args[2], "::", port);
args[3] = "--no-secure";
args[4] = 0;
execv(args[0], args);
gpr_asprintf(&args[0], "%s/fling_server%s", root, gpr_subprocess_binary_extension());
args[1] = "--bind";
gpr_join_host_port(&args[2], "::", port);
args[3] = "--no-secure";
svr = gpr_subprocess_create(4, args);
gpr_free(args[0]);
gpr_free(args[2]);
gpr_free(args[0]);
gpr_free(args[2]);
return 1;
}
/* wait a little */
sleep(2);
/* start the client */
cli = fork();
if (cli == 0) {
gpr_asprintf(&args[0], "%s/fling_client", root);
args[1] = "--target";
gpr_join_host_port(&args[2], "127.0.0.1", port);
args[3] = "--scenario=ping-pong-request";
args[4] = "--no-secure";
args[5] = 0;
execv(args[0], args);
gpr_asprintf(&args[0], "%s/fling_client%s", root, gpr_subprocess_binary_extension());
args[1] = "--target";
gpr_join_host_port(&args[2], "127.0.0.1", port);
args[3] = "--scenario=ping-pong-request";
args[4] = "--no-secure";
args[5] = 0;
cli = gpr_subprocess_create(6, args);
gpr_free(args[0]);
gpr_free(args[2]);
gpr_free(args[0]);
gpr_free(args[2]);
return 1;
}
/* wait for completion */
printf("waiting for client\n");
if (waitpid(cli, &status, 0) == -1) return 2;
if (!WIFEXITED(status)) return 4;
if (WEXITSTATUS(status)) return WEXITSTATUS(status);
printf("waiting for server\n");
kill(svr, SIGINT);
if (waitpid(svr, &status, 0) == -1) return 2;
if (!WIFEXITED(status)) return 4;
if (WEXITSTATUS(status)) return WEXITSTATUS(status);
return 0;
if ((status = gpr_subprocess_join(cli))) {
gpr_subprocess_destroy(cli);
gpr_subprocess_destroy(svr);
return status;
}
gpr_subprocess_destroy(cli);
gpr_subprocess_interrupt(svr);
status = gpr_subprocess_join(svr);
gpr_subprocess_destroy(svr);
return status;
}

@ -256,19 +256,16 @@ static tsi_peer peer_from_cert_name_test_entry(
name_list *nl;
parsed_dns_names dns_entries = parse_dns_names(entry->dns_names);
nl = dns_entries.names;
GPR_ASSERT(tsi_construct_peer(2, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_peer(1 + dns_entries.name_count, &peer) == TSI_OK);
GPR_ASSERT(tsi_construct_string_peer_property_from_cstring(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, entry->common_name,
&peer.properties[0]) == TSI_OK);
GPR_ASSERT(tsi_construct_list_peer_property(
TSI_X509_SUBJECT_ALTERNATIVE_NAMES_PEER_PROPERTY,
dns_entries.name_count, &peer.properties[1]) == TSI_OK);
i = 0;
i = 1;
while (nl != NULL) {
char *processed = processed_dns_name(nl->name);
GPR_ASSERT(tsi_construct_string_peer_property(
NULL, processed, strlen(nl->name),
&peer.properties[1].value.list.children[i++]) == TSI_OK);
TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, processed,
strlen(nl->name), &peer.properties[i++]) == TSI_OK);
nl = nl->next;
gpr_free(processed);
}

@ -0,0 +1,66 @@
# 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.
# Dockerfile for the gRPC Java dev image
FROM grpc/java_base
# Required by accessing Android's aapt
RUN apt-get install -y lib32stdc++6 lib32z1 && apt-get clean
# Install Android SDK 24.2
RUN curl -L http://dl.google.com/android/android-sdk_r24.2-linux.tgz | tar xz -C /usr/local
# Environment variables
ENV ANDROID_HOME /usr/local/android-sdk-linux
ENV PATH $PATH:$ANDROID_HOME/tools
ENV PATH $PATH:$ANDROID_HOME/platform-tools
# Some old Docker versions consider '/' as HOME
ENV HOME /root
# Update sdk for android 5.1 (API level 22)
RUN echo y | android update sdk --all --filter platform-tools,build-tools-22.0.1,sys-img-armeabi-v7a-android-22,android-22,extra-android-m2repository,extra-google-m2repository --no-ui --force
# Create an AVD with API level 22
RUN echo no | android create avd --force -n avd-api-22 -t android-22
# Pull gRPC Java and trigger download of needed Maven and Gradle artifacts.
RUN git clone --depth 1 https://github.com/grpc/grpc-java.git /var/local/git/grpc-java && \
cd /var/local/git/grpc-java && \
./gradlew grpc-core:install grpc-stub:install grpc-okhttp:install grpc-protobuf-nano:install && \
rm -r "$(pwd)"
# Pull gRPC Android integration test App
RUN git clone --depth 1 https://github.com/madongfly/grpc-android-test.git /var/local/git/grpc-android-test
# Config android sdk for gradle
RUN cd /var/local/git/grpc-android-test && echo "sdk.dir=/usr/local/android-sdk-linux" > local.properties
# Build apks to trigger download of needed Maven and Gradle artifacts.
RUN cd /var/local/git/grpc-android-test && ./gradlew assembleDebug
RUN cd /var/local/git/grpc-android-test && ./gradlew assembleDebugAndroidTest

@ -0,0 +1,42 @@
GRPC Android Dockerfile
====================
Dockerfile for creating the gRPC Android integration test image
As of 2015/05 this
- is based on the gRPC Java base
- installs Android sdk 24.2
- creates an AVD for API level 22
- Pulls gRpc Android test App from github
Usage
-----
Start the emulator in a detached container, the argument is the name of the AVD you want to start:
```
$ sudo docker run --name=grpc_android_test -d grpc/android /var/local/git/grpc-android-test/start-emulator.sh avd-api-22
```
You can use the following cammand to wait until the emulator is ready:
```
$ sudo docker exec grpc_android_test /var/local/git/grpc-android-test/wait-for-emulator.sh
```
When you want to update the apk, run:
```
$ sudo docker exec grpc_android_test /var/local/git/grpc-android-test/update-apk.sh
```
It will pull the fresh code of gRpc Java and our integration test app from github, build and install it to the runing emulator (so you need to make sure there is a runing emulator).
Trigger the integration test:
```
$ sudo docker exec grpc_android_test /var/local/git/grpc-android-test/run-test.sh -e server_host <hostname or ip address> -e server_port 8030 -e server_host_override foo.test.google.fr -e use_tls true -e use_test_ca true
```
You can also use the android/adb cammands to get more info, such as:
```
$ sudo docker exec grpc_android_test android list avd
$ sudo docker exec grpc_android_test adb devices
$ sudo docker exec grpc_android_test adb logcat
```

@ -29,11 +29,8 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
thisfile=$(readlink -ne "${BASH_SOURCE[0]}")
current_time=$(date "+%Y-%m-%d-%H-%M-%S")
result_file_name=cloud_prod_result.$current_time.html
echo $result_file_name
pass_log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/cloud_prod_pass_log_history
fail_log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/cloud_prod_fail_log_history
cur=$(date "+%Y-%m-%d-%H-%M-%S")
log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/prod_result/prod/$cur/logs
main() {
source grpc_docker.sh
@ -47,12 +44,12 @@ main() {
log_file_name=cloud_{$test_case}_{$client}.txt
if grpc_cloud_prod_test $test_case grpc-docker-testclients $client > /tmp/$log_file_name 2>&1
then
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_pass_log_history/$log_file_name
echo " ['$test_case', '$client', 'prod', true, '<a href="$pass_log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt
echo " ['$test_case', '$client', 'prod', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt
else
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_fail_log_history/$log_file_name
echo " ['$test_case', '$client', 'prod', false, '<a href="$fail_log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt
echo " ['$test_case', '$client', 'prod', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt
fi
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/prod_result/prod/$cur/logs/$log_file_name
rm /tmp/$log_file_name
done
done
for test_case in "${auth_test_cases[@]}"
@ -62,24 +59,19 @@ main() {
log_file_name=cloud_{$test_case}_{$client}.txt
if grpc_cloud_prod_auth_test $test_case grpc-docker-testclients $client > /tmp/$log_file_name 2>&1
then
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_pass_log_history/$log_file_name
echo " ['$test_case', '$client', 'prod', true, '<a href="$pass_log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt
echo " ['$test_case', '$client', 'prod', true, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt
else
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_fail_log_history/$log_file_name
echo " ['$test_case', '$client', 'prod', false, '<a href="$fail_log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt
echo " ['$test_case', '$client', 'prod', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/cloud_prod_result.txt
fi
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/prod_result/prod/$cur/logs/$log_file_name
rm /tmp/$log_file_name
done
done
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
cat pre.html /tmp/cloud_prod_result.txt post.html > /tmp/cloud_prod_result.html
gsutil cp /tmp/cloud_prod_result.txt gs://stoked-keyword-656-output/cloud_prod_result.txt
gsutil cp -R gs://stoked-keyword-656-output/cloud_prod_pass_log_history gs://stoked-keyword-656-output/log
gsutil cp -R gs://stoked-keyword-656-output/cloud_prod_fail_log_history gs://stoked-keyword-656-output/log
gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/cloud_prod_result.html
gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/result_history/$result_file_name
gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/prod_result/prod/$cur/cloud_prod_result.html
rm /tmp/cloud_prod_result.txt
rm /tmp/cloud_prod_result.html
rm /tmp/cloud*.txt
fi
}

@ -1336,6 +1336,21 @@ grpc_cloud_prod_auth_compute_engine_creds_gen_php_cmd() {
echo $the_cmd
}
# constructs the full dockerized php jwt_token_creds auth interop test cmd.
#
# call-seq:
# flags= .... # generic flags to include the command
# cmd=$($grpc_gen_test_cmd $flags)
grpc_cloud_prod_auth_jwt_token_creds_gen_php_cmd() {
local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem "
env_flag+="-e GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-7dd63462c60c.json "
local cmd_prefix="sudo docker run $env_flag grpc/php";
local test_script="/var/local/git/grpc/src/php/bin/interop_client.sh";
local gfe_flags=$(_grpc_prod_gfe_flags);
local the_cmd="$cmd_prefix $test_script $gfe_flags $@";
echo $the_cmd
}
# constructs the full dockerized node interop test cmd.
#
# call-seq:

@ -34,7 +34,7 @@ client_vm=$2
server_vm=$3
result=interop_result.$1
cur=$(date "+%Y-%m-%d-%H-%M-%S")
log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/interop_result/$test_case/$cur
log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/interop_result/$test_case/$cur/logs
main() {
source grpc_docker.sh
@ -51,7 +51,7 @@ main() {
else
echo " ['$test_case', '$client', '$server', false, '<a href="$log_link/$log_file_name">log</a>']," >> /tmp/$result.txt
fi
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_result/$test_case/$cur/$log_file_name
gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_result/$test_case/$cur/logs/$log_file_name
rm /tmp/$log_file_name
done
done

@ -39,4 +39,4 @@ root=`pwd`
export LD_LIBRARY_PATH=$root/libs/$CONFIG
$root/src/node/node_modules/mocha/bin/mocha --timeout 4000 $root/src/node/test
$root/src/node/node_modules/mocha/bin/mocha --timeout 8000 $root/src/node/test

@ -184,10 +184,14 @@ class PythonLanguage(object):
def test_specs(self, config, travis):
modules = [config.job_spec(['tools/run_tests/run_python.sh', '-m',
test['module']], None)
test['module']],
None,
shortname=test['module'])
for test in self._tests if 'module' in test]
files = [config.job_spec(['tools/run_tests/run_python.sh',
test['file']], None)
test['file']],
None,
shortname=test['file'])
for test in self._tests if 'file' in test]
return files + modules

@ -893,6 +893,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -1136,6 +1145,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -1357,6 +1375,14 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_fullstack_uds_posix_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -1595,6 +1621,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -1838,6 +1873,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -2081,6 +2125,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -2324,6 +2377,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -2558,6 +2620,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -2771,6 +2842,14 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_fullstack_uds_posix_request_response_with_trailing_metadata_and_payload_unsecure_test",
"platforms": [
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -3000,6 +3079,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",
@ -3234,6 +3322,15 @@
"posix"
]
},
{
"flaky": false,
"language": "c",
"name": "chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test",
"platforms": [
"windows",
"posix"
]
},
{
"flaky": false,
"language": "c",

File diff suppressed because one or more lines are too long

@ -161,6 +161,7 @@
<ClInclude Include="..\..\include\grpc\support\port_platform.h" />
<ClInclude Include="..\..\include\grpc\support\slice.h" />
<ClInclude Include="..\..\include\grpc\support\slice_buffer.h" />
<ClInclude Include="..\..\include\grpc\support\subprocess.h" />
<ClInclude Include="..\..\include\grpc\support\sync.h" />
<ClInclude Include="..\..\include\grpc\support\sync_generic.h" />
<ClInclude Include="..\..\include\grpc\support\sync_posix.h" />
@ -234,6 +235,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\support\string_win32.c">
</ClCompile>
<ClCompile Include="..\..\src\core\support\subprocess_posix.c">
</ClCompile>
<ClCompile Include="..\..\src\core\support\sync.c">
</ClCompile>
<ClCompile Include="..\..\src\core\support\sync_posix.c">
@ -252,6 +255,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\support\time_win32.c">
</ClCompile>
<ClCompile Include="..\..\src\core\support\tls_pthread.c">
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

@ -79,6 +79,9 @@
<ClCompile Include="..\..\src\core\support\string_win32.c">
<Filter>src\core\support</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\support\subprocess_posix.c">
<Filter>src\core\support</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\support\sync.c">
<Filter>src\core\support</Filter>
</ClCompile>
@ -106,6 +109,9 @@
<ClCompile Include="..\..\src\core\support\time_win32.c">
<Filter>src\core\support</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\support\tls_pthread.c">
<Filter>src\core\support</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\grpc\support\alloc.h">
@ -153,6 +159,9 @@
<ClInclude Include="..\..\include\grpc\support\slice_buffer.h">
<Filter>include\grpc\support</Filter>
</ClInclude>
<ClInclude Include="..\..\include\grpc\support\subprocess.h">
<Filter>include\grpc\support</Filter>
</ClInclude>
<ClInclude Include="..\..\include\grpc\support\sync.h">
<Filter>include\grpc\support</Filter>
</ClInclude>

@ -16,5 +16,7 @@ Build all flavors of gRPC C# extension and package them as a NuGet package.
```
buildall.bat
nuget pack grpc.native.csharp_ext
```
nuget pack grpc.native.csharp_ext.nuspec
```
When building the NuGet package, ignore the "Assembly outside lib folder" warnings (they DLLs are not assemblies, they are native libraries).

@ -2,14 +2,14 @@
<package>
<metadata>
<id>grpc.native.csharp_ext</id>
<version>0.6.0.0</version>
<version>0.8.0.0</version>
<authors>Google Inc.</authors>
<owners>Jan Tattermusch</owners>
<licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl>
<projectUrl>http://github.com/grpc/grpc</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Native extension needed by gRPC C# library. This is not the package you are looking for, it is only meant to be used as a dependency.</description>
<releaseNotes>Release of gRPC C core 0.6.0 libraries.</releaseNotes>
<releaseNotes>Release of gRPC C core 0.8.0 libraries.</releaseNotes>
<copyright>Copyright 2015</copyright>
<title>gRPC C# Native Extension</title>
<summary>Native library required by gRPC C#</summary>

Loading…
Cancel
Save