Merge github.com:grpc/grpc into all-the-small-things

pull/1489/head
Craig Tiller 10 years ago
commit 696929e09c
  1. 226
      Makefile
  2. 6
      build.json
  3. 4
      include/grpc/grpc.h
  4. 4
      include/grpc/support/port_platform.h
  5. 13
      src/core/iomgr/socket_utils_common_posix.c
  6. 5
      src/core/iomgr/socket_utils_posix.h
  7. 3
      src/core/iomgr/tcp_client_posix.c
  8. 8
      src/core/iomgr/tcp_posix.c
  9. 5
      src/core/iomgr/tcp_server_posix.c
  10. 37
      src/core/surface/call.c
  11. 7
      src/core/transport/chttp2_transport.c
  12. 16
      src/core/transport/metadata.c
  13. 3
      src/core/transport/metadata.h
  14. 8
      src/cpp/server/server.cc
  15. 6
      src/csharp/Grpc.Core.Tests/ClientServerTest.cs
  16. 2
      src/csharp/Grpc.Core.Tests/ServerTest.cs
  17. 4
      src/csharp/Grpc.Core/AsyncClientStreamingCall.cs
  18. 4
      src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs
  19. 3
      src/csharp/Grpc.Core/AsyncServerStreamingCall.cs
  20. 2
      src/csharp/Grpc.Core/Call.cs
  21. 10
      src/csharp/Grpc.Core/Calls.cs
  22. 1
      src/csharp/Grpc.Core/Grpc.Core.csproj
  23. 3
      src/csharp/Grpc.Core/IAsyncStreamReader.cs
  24. 1
      src/csharp/Grpc.Core/IAsyncStreamWriter.cs
  25. 1
      src/csharp/Grpc.Core/IClientStreamWriter.cs
  26. 1
      src/csharp/Grpc.Core/IServerStreamWriter.cs
  27. 4
      src/csharp/Grpc.Core/Internal/AsyncCallServer.cs
  28. 2
      src/csharp/Grpc.Core/Internal/ClientRequestStream.cs
  29. 2
      src/csharp/Grpc.Core/Internal/ClientResponseStream.cs
  30. 20
      src/csharp/Grpc.Core/Internal/ServerCallHandler.cs
  31. 8
      src/csharp/Grpc.Core/Internal/ServerCalls.cs
  32. 2
      src/csharp/Grpc.Core/Internal/ServerRequestStream.cs
  33. 2
      src/csharp/Grpc.Core/Internal/ServerResponseStream.cs
  34. 53
      src/csharp/Grpc.Core/Server.cs
  35. 56
      src/csharp/Grpc.Core/ServerCallContext.cs
  36. 16
      src/csharp/Grpc.Core/ServerMethods.cs
  37. 8
      src/csharp/Grpc.Core/ServerServiceDefinition.cs
  38. 2
      src/csharp/Grpc.Core/Stub/AbstractStub.cs
  39. 2
      src/csharp/Grpc.Examples.MathServer/MathServer.cs
  40. 2
      src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
  41. 8
      src/csharp/Grpc.Examples/MathGrpc.cs
  42. 8
      src/csharp/Grpc.Examples/MathServiceImpl.cs
  43. 2
      src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
  44. 9
      src/csharp/Grpc.IntegrationTesting/InteropServer.cs
  45. 12
      src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs
  46. 12
      src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
  47. 3
      src/php/.gitignore
  48. 315
      src/php/composer.lock
  49. 3
      test/core/end2end/gen_build_json.py
  50. 7
      test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
  51. 4
      test/core/util/test_config.c
  52. 1
      test/cpp/qps/smoke_test.cc
  53. 2
      tools/dockerfile/grpc_java/Dockerfile
  54. 2
      tools/dockerfile/grpc_java/build.sh
  55. 99
      tools/run_tests/tests.json
  56. 34
      vsprojects/Grpc.mak

File diff suppressed because one or more lines are too long

@ -2053,8 +2053,7 @@
}, },
{ {
"name": "qps_driver", "name": "qps_driver",
"build": "test", "build": "tool",
"run": false,
"language": "c++", "language": "c++",
"src": [ "src": [
"test/cpp/qps/qps_driver.cc" "test/cpp/qps/qps_driver.cc"
@ -2090,8 +2089,7 @@
}, },
{ {
"name": "qps_worker", "name": "qps_worker",
"build": "test", "build": "tool",
"run": false,
"language": "c++", "language": "c++",
"headers": [ "headers": [
"test/cpp/qps/client.h", "test/cpp/qps/client.h",

@ -140,7 +140,9 @@ typedef enum grpc_call_error {
/* there is already an outstanding read/write operation on the call */ /* there is already an outstanding read/write operation on the call */
GRPC_CALL_ERROR_TOO_MANY_OPERATIONS, GRPC_CALL_ERROR_TOO_MANY_OPERATIONS,
/* the flags value was illegal for this call */ /* the flags value was illegal for this call */
GRPC_CALL_ERROR_INVALID_FLAGS GRPC_CALL_ERROR_INVALID_FLAGS,
/* invalid metadata was passed to this call */
GRPC_CALL_ERROR_INVALID_METADATA
} grpc_call_error; } grpc_call_error;
/* Result of a grpc operation */ /* Result of a grpc operation */

@ -80,6 +80,7 @@
#define GPR_POSIX_SYNC 1 #define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1 #define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1 #define GPR_GETPID_IN_UNISTD_H 1
#define GPR_HAVE_MSG_NOSIGNAL 1
#elif defined(__linux__) #elif defined(__linux__)
#ifndef _BSD_SOURCE #ifndef _BSD_SOURCE
#define _BSD_SOURCE #define _BSD_SOURCE
@ -124,6 +125,7 @@
#define GPR_POSIX_SYNC 1 #define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1 #define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1 #define GPR_GETPID_IN_UNISTD_H 1
#define GPR_HAVE_MSG_NOSIGNAL 1
#ifdef _LP64 #ifdef _LP64
#define GPR_ARCH_64 1 #define GPR_ARCH_64 1
#else /* _LP64 */ #else /* _LP64 */
@ -155,6 +157,7 @@
#define GPR_POSIX_SYNC 1 #define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1 #define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1 #define GPR_GETPID_IN_UNISTD_H 1
#define GPR_HAVE_SO_NOSIGPIPE 1
#ifdef _LP64 #ifdef _LP64
#define GPR_ARCH_64 1 #define GPR_ARCH_64 1
#else /* _LP64 */ #else /* _LP64 */
@ -180,6 +183,7 @@
#define GPR_POSIX_SYNC 1 #define GPR_POSIX_SYNC 1
#define GPR_POSIX_TIME 1 #define GPR_POSIX_TIME 1
#define GPR_GETPID_IN_UNISTD_H 1 #define GPR_GETPID_IN_UNISTD_H 1
#define GPR_HAVE_SO_NOSIGPIPE 1
#ifdef _LP64 #ifdef _LP64
#define GPR_ARCH_64 1 #define GPR_ARCH_64 1
#else /* _LP64 */ #else /* _LP64 */

@ -76,6 +76,19 @@ int grpc_set_socket_nonblocking(int fd, int non_blocking) {
return 1; return 1;
} }
int grpc_set_socket_no_sigpipe_if_possible(int fd) {
#ifdef GPR_HAVE_SO_NOSIGPIPE
int val = 1;
int newval;
socklen_t intlen = sizeof(newval);
return 0 == setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val)) &&
0 == getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &newval, &intlen) &&
(newval != 0) == val;
#else
return 1;
#endif
}
/* set a socket to close on exec */ /* set a socket to close on exec */
int grpc_set_socket_cloexec(int fd, int close_on_exec) { int grpc_set_socket_cloexec(int fd, int close_on_exec) {
int oldflags = fcntl(fd, F_GETFD, 0); int oldflags = fcntl(fd, F_GETFD, 0);

@ -63,6 +63,11 @@ int grpc_set_socket_low_latency(int fd, int low_latency);
state to library users, we turn off IPv6 sockets. */ state to library users, we turn off IPv6 sockets. */
int grpc_ipv6_loopback_available(void); int grpc_ipv6_loopback_available(void);
/* Tries to set SO_NOSIGPIPE if available on this platform.
Returns 1 on success, 0 on failure.
If SO_NO_SIGPIPE is not available, returns 1. */
int grpc_set_socket_no_sigpipe_if_possible(int fd);
/* An enum to keep track of IPv4/IPv6 socket modes. /* An enum to keep track of IPv4/IPv6 socket modes.
Currently, this information is only used when a socket is first created, but Currently, this information is only used when a socket is first created, but

@ -69,7 +69,8 @@ static int prepare_socket(const struct sockaddr *addr, int fd) {
} }
if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) || if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) ||
(addr->sa_family != AF_UNIX && !grpc_set_socket_low_latency(fd, 1))) { (addr->sa_family != AF_UNIX && !grpc_set_socket_low_latency(fd, 1)) ||
!grpc_set_socket_no_sigpipe_if_possible(fd)) {
gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd, gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd,
strerror(errno)); strerror(errno));
goto error; goto error;

@ -53,6 +53,12 @@
#include <grpc/support/sync.h> #include <grpc/support/sync.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
#ifdef GPR_HAVE_MSG_NOSIGNAL
#define SENDMSG_FLAGS MSG_NOSIGNAL
#else
#define SENDMSG_FLAGS 0
#endif
/* Holds a slice array and associated state. */ /* Holds a slice array and associated state. */
typedef struct grpc_tcp_slice_state { typedef struct grpc_tcp_slice_state {
gpr_slice *slices; /* Array of slices */ gpr_slice *slices; /* Array of slices */
@ -461,7 +467,7 @@ static grpc_endpoint_write_status grpc_tcp_flush(grpc_tcp *tcp) {
GRPC_TIMER_BEGIN(GRPC_PTAG_SENDMSG, 0); GRPC_TIMER_BEGIN(GRPC_PTAG_SENDMSG, 0);
do { do {
/* TODO(klempner): Cork if this is a partial write */ /* TODO(klempner): Cork if this is a partial write */
sent_length = sendmsg(tcp->fd, &msg, 0); sent_length = sendmsg(tcp->fd, &msg, SENDMSG_FLAGS);
} while (sent_length < 0 && errno == EINTR); } while (sent_length < 0 && errno == EINTR);
GRPC_TIMER_END(GRPC_PTAG_SENDMSG, 0); GRPC_TIMER_END(GRPC_PTAG_SENDMSG, 0);

@ -235,7 +235,8 @@ static int prepare_socket(int fd, const struct sockaddr *addr, int addr_len) {
if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) || if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) ||
(addr->sa_family != AF_UNIX && (!grpc_set_socket_low_latency(fd, 1) || (addr->sa_family != AF_UNIX && (!grpc_set_socket_low_latency(fd, 1) ||
!grpc_set_socket_reuse_addr(fd, 1)))) { !grpc_set_socket_reuse_addr(fd, 1))) ||
!grpc_set_socket_no_sigpipe_if_possible(fd)) {
gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd, gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd,
strerror(errno)); strerror(errno));
goto error; goto error;
@ -296,6 +297,8 @@ static void on_read(void *arg, int success) {
} }
} }
grpc_set_socket_no_sigpipe_if_possible(fd);
sp->server->cb( sp->server->cb(
sp->server->cb_arg, sp->server->cb_arg,
grpc_tcp_create(grpc_fd_create(fd), GRPC_TCP_DEFAULT_READ_SLICE_SIZE)); grpc_tcp_create(grpc_fd_create(fd), GRPC_TCP_DEFAULT_READ_SLICE_SIZE));

@ -739,14 +739,9 @@ static void call_on_done_recv(void *pc, int success) {
GRPC_TIMER_BEGIN(GRPC_PTAG_CALL_ON_DONE_RECV, 0); GRPC_TIMER_BEGIN(GRPC_PTAG_CALL_ON_DONE_RECV, 0);
} }
static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count, static int prepare_application_metadata(grpc_call *call, size_t count,
grpc_metadata *metadata) { grpc_metadata *metadata) {
size_t i; size_t i;
grpc_mdelem_list out;
if (count == 0) {
out.head = out.tail = NULL;
return out;
}
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
grpc_metadata *md = &metadata[i]; grpc_metadata *md = &metadata[i];
grpc_metadata *next_md = (i == count - 1) ? NULL : &metadata[i + 1]; grpc_metadata *next_md = (i == count - 1) ? NULL : &metadata[i + 1];
@ -756,9 +751,27 @@ static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count,
l->md = grpc_mdelem_from_string_and_buffer(call->metadata_context, md->key, l->md = grpc_mdelem_from_string_and_buffer(call->metadata_context, md->key,
(const gpr_uint8 *)md->value, (const gpr_uint8 *)md->value,
md->value_length); md->value_length);
if (!grpc_mdstr_is_legal_header(l->md->key)) {
gpr_log(GPR_ERROR, "attempt to send invalid metadata key");
return 0;
} else if (!grpc_mdstr_is_bin_suffixed(l->md->key) &&
!grpc_mdstr_is_legal_header(l->md->value)) {
gpr_log(GPR_ERROR, "attempt to send invalid metadata value");
return 0;
}
l->next = next_md ? (grpc_linked_mdelem *)&next_md->internal_data : NULL; l->next = next_md ? (grpc_linked_mdelem *)&next_md->internal_data : NULL;
l->prev = prev_md ? (grpc_linked_mdelem *)&prev_md->internal_data : NULL; l->prev = prev_md ? (grpc_linked_mdelem *)&prev_md->internal_data : NULL;
} }
return 1;
}
static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count,
grpc_metadata *metadata) {
grpc_mdelem_list out;
if (count == 0) {
out.head = out.tail = NULL;
return out;
}
out.head = (grpc_linked_mdelem *)&(metadata[0].internal_data); out.head = (grpc_linked_mdelem *)&(metadata[0].internal_data);
out.tail = (grpc_linked_mdelem *)&(metadata[count - 1].internal_data); out.tail = (grpc_linked_mdelem *)&(metadata[count - 1].internal_data);
return out; return out;
@ -954,8 +967,16 @@ static grpc_call_error start_ioreq(grpc_call *call, const grpc_ioreq *reqs,
} else if (call->request_set[op] == REQSET_DONE) { } else if (call->request_set[op] == REQSET_DONE) {
return start_ioreq_error(call, have_ops, GRPC_CALL_ERROR_ALREADY_INVOKED); return start_ioreq_error(call, have_ops, GRPC_CALL_ERROR_ALREADY_INVOKED);
} }
have_ops |= 1u << op;
data = reqs[i].data; data = reqs[i].data;
if (op == GRPC_IOREQ_SEND_INITIAL_METADATA ||
op == GRPC_IOREQ_SEND_TRAILING_METADATA) {
if (!prepare_application_metadata(call, data.send_metadata.count,
data.send_metadata.metadata)) {
return start_ioreq_error(call, have_ops,
GRPC_CALL_ERROR_INVALID_METADATA);
}
}
have_ops |= 1u << op;
call->request_data[op] = data; call->request_data[op] = data;
call->request_set[op] = set; call->request_set[op] = set;

@ -824,12 +824,9 @@ static void unlock(transport *t) {
/* gather any callbacks that need to be made */ /* gather any callbacks that need to be made */
if (!t->calling_back) { if (!t->calling_back) {
perform_callbacks = prepare_callbacks(t); t->calling_back = perform_callbacks = prepare_callbacks(t);
if (perform_callbacks) {
t->calling_back = 1;
}
if (cb) { if (cb) {
if (t->error_state == ERROR_STATE_SEEN && !t->writing && !t->calling_back) { if (t->error_state == ERROR_STATE_SEEN && !t->writing) {
call_closed = 1; call_closed = 1;
t->calling_back = 1; t->calling_back = 1;
t->cb = NULL; /* no more callbacks */ t->cb = NULL; /* no more callbacks */

@ -569,3 +569,19 @@ void grpc_mdctx_locked_mdelem_unref(grpc_mdctx *ctx, grpc_mdelem *gmd) {
} }
void grpc_mdctx_unlock(grpc_mdctx *ctx) { unlock(ctx); } void grpc_mdctx_unlock(grpc_mdctx *ctx) { unlock(ctx); }
int grpc_mdstr_is_legal_header(grpc_mdstr *s) {
/* TODO(ctiller): consider caching this, or computing it on construction */
const gpr_uint8 *p = GPR_SLICE_START_PTR(s->slice);
const gpr_uint8 *e = GPR_SLICE_END_PTR(s->slice);
for (; p != e; p++) {
if (*p < 32 || *p > 126) return 0;
}
return 1;
}
int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s) {
/* TODO(ctiller): consider caching this */
return grpc_is_binary_header((const char *)GPR_SLICE_START_PTR(s->slice),
GPR_SLICE_LENGTH(s->slice));
}

@ -135,6 +135,9 @@ void grpc_mdelem_unref(grpc_mdelem *md);
Does not promise that the returned string has no embedded nulls however. */ Does not promise that the returned string has no embedded nulls however. */
const char *grpc_mdstr_as_c_string(grpc_mdstr *s); const char *grpc_mdstr_as_c_string(grpc_mdstr *s);
int grpc_mdstr_is_legal_header(grpc_mdstr *s);
int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s);
/* Batch mode metadata functions. /* Batch mode metadata functions.
These API's have equivalents above, but allow taking the mdctx just once, These API's have equivalents above, but allow taking the mdctx just once,
performing a bunch of work, and then leaving the mdctx. */ performing a bunch of work, and then leaving the mdctx. */

@ -446,8 +446,12 @@ void Server::RunRpc() {
ScheduleCallback(); ScheduleCallback();
if (ok) { if (ok) {
SyncRequest::CallData cd(this, mrd); SyncRequest::CallData cd(this, mrd);
mrd->Request(server_); {
grpc::unique_lock<grpc::mutex> lock(mu_);
if (!shutdown_) {
mrd->Request(server_);
}
}
cd.Run(); cd.Run();
} }
} }

@ -84,7 +84,7 @@ namespace Grpc.Core.Tests
{ {
server = new Server(); server = new Server();
server.AddServiceDefinition(ServiceDefinition); server.AddServiceDefinition(ServiceDefinition);
int port = server.AddListeningPort(Host + ":0"); int port = server.AddListeningPort(Host, Server.PickUnusedPort);
server.Start(); server.Start();
channel = new Channel(Host + ":" + port); channel = new Channel(Host + ":" + port);
} }
@ -220,7 +220,7 @@ namespace Grpc.Core.Tests
} }
} }
private static async Task<string> EchoHandler(string request) private static async Task<string> EchoHandler(ServerCallContext context, string request)
{ {
if (request == "THROW") if (request == "THROW")
{ {
@ -229,7 +229,7 @@ namespace Grpc.Core.Tests
return request; return request;
} }
private static async Task<string> ConcatAndEchoHandler(IAsyncStreamReader<string> requestStream) private static async Task<string> ConcatAndEchoHandler(ServerCallContext context, IAsyncStreamReader<string> requestStream)
{ {
string result = ""; string result = "";
await requestStream.ForEach(async (request) => await requestStream.ForEach(async (request) =>

@ -47,7 +47,7 @@ namespace Grpc.Core.Tests
GrpcEnvironment.Initialize(); GrpcEnvironment.Initialize();
Server server = new Server(); Server server = new Server();
server.AddListeningPort("localhost:0"); server.AddListeningPort("localhost", Server.PickUnusedPort);
server.Start(); server.Start();
server.ShutdownAsync().Wait(); server.ShutdownAsync().Wait();

@ -40,7 +40,9 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Return type for client streaming calls. /// Return type for client streaming calls.
/// </summary> /// </summary>
public struct AsyncClientStreamingCall<TRequest, TResponse> public sealed class AsyncClientStreamingCall<TRequest, TResponse>
where TRequest : class
where TResponse : class
{ {
readonly IClientStreamWriter<TRequest> requestStream; readonly IClientStreamWriter<TRequest> requestStream;
readonly Task<TResponse> result; readonly Task<TResponse> result;

@ -40,7 +40,9 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Return type for bidirectional streaming calls. /// Return type for bidirectional streaming calls.
/// </summary> /// </summary>
public struct AsyncDuplexStreamingCall<TRequest, TResponse> public sealed class AsyncDuplexStreamingCall<TRequest, TResponse>
where TRequest : class
where TResponse : class
{ {
readonly IClientStreamWriter<TRequest> requestStream; readonly IClientStreamWriter<TRequest> requestStream;
readonly IAsyncStreamReader<TResponse> responseStream; readonly IAsyncStreamReader<TResponse> responseStream;

@ -40,7 +40,8 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Return type for server streaming calls. /// Return type for server streaming calls.
/// </summary> /// </summary>
public struct AsyncServerStreamingCall<TResponse> public sealed class AsyncServerStreamingCall<TResponse>
where TResponse : class
{ {
readonly IAsyncStreamReader<TResponse> responseStream; readonly IAsyncStreamReader<TResponse> responseStream;

@ -41,6 +41,8 @@ namespace Grpc.Core
/// Abstraction of a call to be invoked on a client. /// Abstraction of a call to be invoked on a client.
/// </summary> /// </summary>
public class Call<TRequest, TResponse> public class Call<TRequest, TResponse>
where TRequest : class
where TResponse : class
{ {
readonly string name; readonly string name;
readonly Marshaller<TRequest> requestMarshaller; readonly Marshaller<TRequest> requestMarshaller;

@ -44,6 +44,8 @@ namespace Grpc.Core
public static class Calls public static class Calls
{ {
public static TResponse BlockingUnaryCall<TRequest, TResponse>(Call<TRequest, TResponse> call, TRequest req, CancellationToken token) public static TResponse BlockingUnaryCall<TRequest, TResponse>(Call<TRequest, TResponse> call, TRequest req, CancellationToken token)
where TRequest : class
where TResponse : class
{ {
var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer);
// TODO(jtattermusch): this gives a race that cancellation can be requested before the call even starts. // TODO(jtattermusch): this gives a race that cancellation can be requested before the call even starts.
@ -52,6 +54,8 @@ namespace Grpc.Core
} }
public static async Task<TResponse> AsyncUnaryCall<TRequest, TResponse>(Call<TRequest, TResponse> call, TRequest req, CancellationToken token) public static async Task<TResponse> AsyncUnaryCall<TRequest, TResponse>(Call<TRequest, TResponse> call, TRequest req, CancellationToken token)
where TRequest : class
where TResponse : class
{ {
var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer);
asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name);
@ -61,6 +65,8 @@ namespace Grpc.Core
} }
public static AsyncServerStreamingCall<TResponse> AsyncServerStreamingCall<TRequest, TResponse>(Call<TRequest, TResponse> call, TRequest req, CancellationToken token) public static AsyncServerStreamingCall<TResponse> AsyncServerStreamingCall<TRequest, TResponse>(Call<TRequest, TResponse> call, TRequest req, CancellationToken token)
where TRequest : class
where TResponse : class
{ {
var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer);
asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name);
@ -71,6 +77,8 @@ namespace Grpc.Core
} }
public static AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(Call<TRequest, TResponse> call, CancellationToken token) public static AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(Call<TRequest, TResponse> call, CancellationToken token)
where TRequest : class
where TResponse : class
{ {
var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer);
asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name);
@ -81,6 +89,8 @@ namespace Grpc.Core
} }
public static AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(Call<TRequest, TResponse> call, CancellationToken token) public static AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(Call<TRequest, TResponse> call, CancellationToken token)
where TRequest : class
where TResponse : class
{ {
var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); var asyncCall = new AsyncCall<TRequest, TResponse>(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer);
asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name);

@ -96,6 +96,7 @@
<Compile Include="Internal\ServerResponseStream.cs" /> <Compile Include="Internal\ServerResponseStream.cs" />
<Compile Include="Internal\AtomicCounter.cs" /> <Compile Include="Internal\AtomicCounter.cs" />
<Compile Include="Internal\DebugStats.cs" /> <Compile Include="Internal\DebugStats.cs" />
<Compile Include="ServerCallContext.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />

@ -44,9 +44,10 @@ namespace Grpc.Core
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
public interface IAsyncStreamReader<T> public interface IAsyncStreamReader<T>
where T : class
{ {
/// <summary> /// <summary>
/// Reads a single message. Returns default(T) if the last message was already read. /// Reads a single message. Returns null if the last message was already read.
/// A following read can only be started when the previous one finishes. /// A following read can only be started when the previous one finishes.
/// </summary> /// </summary>
Task<T> ReadNext(); Task<T> ReadNext();

@ -44,6 +44,7 @@ namespace Grpc.Core
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
public interface IAsyncStreamWriter<T> public interface IAsyncStreamWriter<T>
where T : class
{ {
/// <summary> /// <summary>
/// Writes a single message. Only one write can be pending at a time. /// Writes a single message. Only one write can be pending at a time.

@ -44,6 +44,7 @@ namespace Grpc.Core
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
public interface IClientStreamWriter<T> : IAsyncStreamWriter<T> public interface IClientStreamWriter<T> : IAsyncStreamWriter<T>
where T : class
{ {
/// <summary> /// <summary>
/// Closes the stream. Can only be called once there is no pending write. No writes should follow calling this. /// Closes the stream. Can only be called once there is no pending write. No writes should follow calling this.

@ -43,6 +43,7 @@ namespace Grpc.Core
/// A writable stream of messages that is used in server-side handlers. /// A writable stream of messages that is used in server-side handlers.
/// </summary> /// </summary>
public interface IServerStreamWriter<T> : IAsyncStreamWriter<T> public interface IServerStreamWriter<T> : IAsyncStreamWriter<T>
where T : class
{ {
} }
} }

@ -138,9 +138,7 @@ namespace Grpc.Core.Internal
ReleaseResourcesIfPossible(); ReleaseResourcesIfPossible();
} }
// TODO(jtattermusch): check if call was cancelled. // TODO(jtattermusch): handle error
// TODO: handle error ...
finishedServersideTcs.SetResult(null); finishedServersideTcs.SetResult(null);
} }

@ -38,6 +38,8 @@ namespace Grpc.Core.Internal
/// Writes requests asynchronously to an underlying AsyncCall object. /// Writes requests asynchronously to an underlying AsyncCall object.
/// </summary> /// </summary>
internal class ClientRequestStream<TRequest, TResponse> : IClientStreamWriter<TRequest> internal class ClientRequestStream<TRequest, TResponse> : IClientStreamWriter<TRequest>
where TRequest : class
where TResponse : class
{ {
readonly AsyncCall<TRequest, TResponse> call; readonly AsyncCall<TRequest, TResponse> call;

@ -38,6 +38,8 @@ using System.Threading.Tasks;
namespace Grpc.Core.Internal namespace Grpc.Core.Internal
{ {
internal class ClientResponseStream<TRequest, TResponse> : IAsyncStreamReader<TResponse> internal class ClientResponseStream<TRequest, TResponse> : IAsyncStreamReader<TResponse>
where TRequest : class
where TResponse : class
{ {
readonly AsyncCall<TRequest, TResponse> call; readonly AsyncCall<TRequest, TResponse> call;

@ -45,6 +45,8 @@ namespace Grpc.Core.Internal
} }
internal class UnaryServerCallHandler<TRequest, TResponse> : IServerCallHandler internal class UnaryServerCallHandler<TRequest, TResponse> : IServerCallHandler
where TRequest : class
where TResponse : class
{ {
readonly Method<TRequest, TResponse> method; readonly Method<TRequest, TResponse> method;
readonly UnaryServerMethod<TRequest, TResponse> handler; readonly UnaryServerMethod<TRequest, TResponse> handler;
@ -72,7 +74,8 @@ namespace Grpc.Core.Internal
var request = await requestStream.ReadNext(); var request = await requestStream.ReadNext();
// TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated.
Preconditions.CheckArgument(await requestStream.ReadNext() == null); Preconditions.CheckArgument(await requestStream.ReadNext() == null);
var result = await handler(request); var context = new ServerCallContext(); // TODO(jtattermusch): initialize the context
var result = await handler(context, request);
await responseStream.Write(result); await responseStream.Write(result);
} }
catch (Exception e) catch (Exception e)
@ -93,6 +96,8 @@ namespace Grpc.Core.Internal
} }
internal class ServerStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler internal class ServerStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler
where TRequest : class
where TResponse : class
{ {
readonly Method<TRequest, TResponse> method; readonly Method<TRequest, TResponse> method;
readonly ServerStreamingServerMethod<TRequest, TResponse> handler; readonly ServerStreamingServerMethod<TRequest, TResponse> handler;
@ -121,7 +126,8 @@ namespace Grpc.Core.Internal
// TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated.
Preconditions.CheckArgument(await requestStream.ReadNext() == null); Preconditions.CheckArgument(await requestStream.ReadNext() == null);
await handler(request, responseStream); var context = new ServerCallContext(); // TODO(jtattermusch): initialize the context
await handler(context, request, responseStream);
} }
catch (Exception e) catch (Exception e)
{ {
@ -142,6 +148,8 @@ namespace Grpc.Core.Internal
} }
internal class ClientStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler internal class ClientStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler
where TRequest : class
where TResponse : class
{ {
readonly Method<TRequest, TResponse> method; readonly Method<TRequest, TResponse> method;
readonly ClientStreamingServerMethod<TRequest, TResponse> handler; readonly ClientStreamingServerMethod<TRequest, TResponse> handler;
@ -162,11 +170,12 @@ namespace Grpc.Core.Internal
var finishedTask = asyncCall.ServerSideCallAsync(); var finishedTask = asyncCall.ServerSideCallAsync();
var requestStream = new ServerRequestStream<TRequest, TResponse>(asyncCall); var requestStream = new ServerRequestStream<TRequest, TResponse>(asyncCall);
var responseStream = new ServerResponseStream<TRequest, TResponse>(asyncCall); var responseStream = new ServerResponseStream<TRequest, TResponse>(asyncCall);
var context = new ServerCallContext(); // TODO(jtattermusch): initialize the context
Status status = Status.DefaultSuccess; Status status = Status.DefaultSuccess;
try try
{ {
var result = await handler(requestStream); var result = await handler(context, requestStream);
try try
{ {
await responseStream.Write(result); await responseStream.Write(result);
@ -195,6 +204,8 @@ namespace Grpc.Core.Internal
} }
internal class DuplexStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler internal class DuplexStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler
where TRequest : class
where TResponse : class
{ {
readonly Method<TRequest, TResponse> method; readonly Method<TRequest, TResponse> method;
readonly DuplexStreamingServerMethod<TRequest, TResponse> handler; readonly DuplexStreamingServerMethod<TRequest, TResponse> handler;
@ -215,11 +226,12 @@ namespace Grpc.Core.Internal
var finishedTask = asyncCall.ServerSideCallAsync(); var finishedTask = asyncCall.ServerSideCallAsync();
var requestStream = new ServerRequestStream<TRequest, TResponse>(asyncCall); var requestStream = new ServerRequestStream<TRequest, TResponse>(asyncCall);
var responseStream = new ServerResponseStream<TRequest, TResponse>(asyncCall); var responseStream = new ServerResponseStream<TRequest, TResponse>(asyncCall);
var context = new ServerCallContext(); // TODO(jtattermusch): initialize the context
Status status = Status.DefaultSuccess; Status status = Status.DefaultSuccess;
try try
{ {
await handler(requestStream, responseStream); await handler(context, requestStream, responseStream);
} }
catch (Exception e) catch (Exception e)
{ {

@ -41,21 +41,29 @@ namespace Grpc.Core.Internal
internal static class ServerCalls internal static class ServerCalls
{ {
public static IServerCallHandler UnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, UnaryServerMethod<TRequest, TResponse> handler) public static IServerCallHandler UnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, UnaryServerMethod<TRequest, TResponse> handler)
where TRequest : class
where TResponse : class
{ {
return new UnaryServerCallHandler<TRequest, TResponse>(method, handler); return new UnaryServerCallHandler<TRequest, TResponse>(method, handler);
} }
public static IServerCallHandler ClientStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, ClientStreamingServerMethod<TRequest, TResponse> handler) public static IServerCallHandler ClientStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, ClientStreamingServerMethod<TRequest, TResponse> handler)
where TRequest : class
where TResponse : class
{ {
return new ClientStreamingServerCallHandler<TRequest, TResponse>(method, handler); return new ClientStreamingServerCallHandler<TRequest, TResponse>(method, handler);
} }
public static IServerCallHandler ServerStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, ServerStreamingServerMethod<TRequest, TResponse> handler) public static IServerCallHandler ServerStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, ServerStreamingServerMethod<TRequest, TResponse> handler)
where TRequest : class
where TResponse : class
{ {
return new ServerStreamingServerCallHandler<TRequest, TResponse>(method, handler); return new ServerStreamingServerCallHandler<TRequest, TResponse>(method, handler);
} }
public static IServerCallHandler DuplexStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, DuplexStreamingServerMethod<TRequest, TResponse> handler) public static IServerCallHandler DuplexStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, DuplexStreamingServerMethod<TRequest, TResponse> handler)
where TRequest : class
where TResponse : class
{ {
return new DuplexStreamingServerCallHandler<TRequest, TResponse>(method, handler); return new DuplexStreamingServerCallHandler<TRequest, TResponse>(method, handler);
} }

@ -38,6 +38,8 @@ using System.Threading.Tasks;
namespace Grpc.Core.Internal namespace Grpc.Core.Internal
{ {
internal class ServerRequestStream<TRequest, TResponse> : IAsyncStreamReader<TRequest> internal class ServerRequestStream<TRequest, TResponse> : IAsyncStreamReader<TRequest>
where TRequest : class
where TResponse : class
{ {
readonly AsyncCallServer<TRequest, TResponse> call; readonly AsyncCallServer<TRequest, TResponse> call;

@ -39,6 +39,8 @@ namespace Grpc.Core.Internal
/// Writes responses asynchronously to an underlying AsyncCallServer object. /// Writes responses asynchronously to an underlying AsyncCallServer object.
/// </summary> /// </summary>
internal class ServerResponseStream<TRequest, TResponse> : IServerStreamWriter<TResponse> internal class ServerResponseStream<TRequest, TResponse> : IServerStreamWriter<TResponse>
where TRequest : class
where TResponse : class
{ {
readonly AsyncCallServer<TRequest, TResponse> call; readonly AsyncCallServer<TRequest, TResponse> call;

@ -47,6 +47,11 @@ namespace Grpc.Core
/// </summary> /// </summary>
public class Server public class Server
{ {
/// <summary>
/// Pass this value as port to have the server choose an unused listening port for you.
/// </summary>
public const int PickUnusedPort = 0;
// TODO(jtattermusch) : make sure the delegate doesn't get garbage collected while // TODO(jtattermusch) : make sure the delegate doesn't get garbage collected while
// native callbacks are in the completion queue. // native callbacks are in the completion queue.
readonly ServerShutdownCallbackDelegate serverShutdownHandler; readonly ServerShutdownCallbackDelegate serverShutdownHandler;
@ -89,29 +94,25 @@ namespace Grpc.Core
/// Add a non-secure port on which server should listen. /// Add a non-secure port on which server should listen.
/// Only call this before Start(). /// Only call this before Start().
/// </summary> /// </summary>
public int AddListeningPort(string addr) /// <returns>The port on which server will be listening.</returns>
/// <param name="host">the host</param>
/// <param name="port">the port. If zero, an unused port is chosen automatically.</param>
public int AddListeningPort(string host, int port)
{ {
lock (myLock) return AddListeningPortInternal(host, port, null);
{
Preconditions.CheckState(!startRequested);
return handle.AddListeningPort(addr);
}
} }
/// <summary> /// <summary>
/// Add a secure port on which server should listen. /// Add a non-secure port on which server should listen.
/// Only call this before Start(). /// Only call this before Start().
/// </summary> /// </summary>
public int AddListeningPort(string addr, ServerCredentials credentials) /// <returns>The port on which server will be listening.</returns>
/// <param name="host">the host</param>
/// <param name="port">the port. If zero, , an unused port is chosen automatically.</param>
public int AddListeningPort(string host, int port, ServerCredentials credentials)
{ {
lock (myLock) Preconditions.CheckNotNull(credentials);
{ return AddListeningPortInternal(host, port, credentials);
Preconditions.CheckState(!startRequested);
using (var nativeCredentials = credentials.ToNativeCredentials())
{
return handle.AddListeningPort(addr, nativeCredentials);
}
}
} }
/// <summary> /// <summary>
@ -164,6 +165,26 @@ namespace Grpc.Core
handle.Dispose(); handle.Dispose();
} }
private int AddListeningPortInternal(string host, int port, ServerCredentials credentials)
{
lock (myLock)
{
Preconditions.CheckState(!startRequested);
var address = string.Format("{0}:{1}", host, port);
if (credentials != null)
{
using (var nativeCredentials = credentials.ToNativeCredentials())
{
return handle.AddListeningPort(address, nativeCredentials);
}
}
else
{
return handle.AddListeningPort(address);
}
}
}
/// <summary> /// <summary>
/// Allows one new RPC call to be received by server. /// Allows one new RPC call to be received by server.
/// </summary> /// </summary>

@ -0,0 +1,56 @@
#region Copyright notice and license
// 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.
#endregion
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Grpc.Core
{
/// <summary>
/// Context for a server-side call.
/// </summary>
public sealed class ServerCallContext
{
// TODO(jtattermusch): add cancellationToken
// TODO(jtattermusch): add deadline info
// TODO(jtattermusch): expose initial metadata sent by client for reading
// TODO(jtattermusch): expose method to send initial metadata back to client
// TODO(jtattermusch): allow setting status and trailing metadata to send after handler completes.
}
}

@ -42,20 +42,28 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Server-side handler for unary call. /// Server-side handler for unary call.
/// </summary> /// </summary>
public delegate Task<TResponse> UnaryServerMethod<TRequest, TResponse>(TRequest request); public delegate Task<TResponse> UnaryServerMethod<TRequest, TResponse>(ServerCallContext context, TRequest request)
where TRequest : class
where TResponse : class;
/// <summary> /// <summary>
/// Server-side handler for client streaming call. /// Server-side handler for client streaming call.
/// </summary> /// </summary>
public delegate Task<TResponse> ClientStreamingServerMethod<TRequest, TResponse>(IAsyncStreamReader<TRequest> requestStream); public delegate Task<TResponse> ClientStreamingServerMethod<TRequest, TResponse>(ServerCallContext context, IAsyncStreamReader<TRequest> requestStream)
where TRequest : class
where TResponse : class;
/// <summary> /// <summary>
/// Server-side handler for server streaming call. /// Server-side handler for server streaming call.
/// </summary> /// </summary>
public delegate Task ServerStreamingServerMethod<TRequest, TResponse>(TRequest request, IServerStreamWriter<TResponse> responseStream); public delegate Task ServerStreamingServerMethod<TRequest, TResponse>(ServerCallContext context, TRequest request, IServerStreamWriter<TResponse> responseStream)
where TRequest : class
where TResponse : class;
/// <summary> /// <summary>
/// Server-side handler for bidi streaming call. /// Server-side handler for bidi streaming call.
/// </summary> /// </summary>
public delegate Task DuplexStreamingServerMethod<TRequest, TResponse>(IAsyncStreamReader<TRequest> requestStream, IServerStreamWriter<TResponse> responseStream); public delegate Task DuplexStreamingServerMethod<TRequest, TResponse>(ServerCallContext context, IAsyncStreamReader<TRequest> requestStream, IServerStreamWriter<TResponse> responseStream)
where TRequest : class
where TResponse : class;
} }

@ -76,6 +76,8 @@ namespace Grpc.Core
public Builder AddMethod<TRequest, TResponse>( public Builder AddMethod<TRequest, TResponse>(
Method<TRequest, TResponse> method, Method<TRequest, TResponse> method,
UnaryServerMethod<TRequest, TResponse> handler) UnaryServerMethod<TRequest, TResponse> handler)
where TRequest : class
where TResponse : class
{ {
callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.UnaryCall(method, handler)); callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.UnaryCall(method, handler));
return this; return this;
@ -84,6 +86,8 @@ namespace Grpc.Core
public Builder AddMethod<TRequest, TResponse>( public Builder AddMethod<TRequest, TResponse>(
Method<TRequest, TResponse> method, Method<TRequest, TResponse> method,
ClientStreamingServerMethod<TRequest, TResponse> handler) ClientStreamingServerMethod<TRequest, TResponse> handler)
where TRequest : class
where TResponse : class
{ {
callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ClientStreamingCall(method, handler)); callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ClientStreamingCall(method, handler));
return this; return this;
@ -92,6 +96,8 @@ namespace Grpc.Core
public Builder AddMethod<TRequest, TResponse>( public Builder AddMethod<TRequest, TResponse>(
Method<TRequest, TResponse> method, Method<TRequest, TResponse> method,
ServerStreamingServerMethod<TRequest, TResponse> handler) ServerStreamingServerMethod<TRequest, TResponse> handler)
where TRequest : class
where TResponse : class
{ {
callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ServerStreamingCall(method, handler)); callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ServerStreamingCall(method, handler));
return this; return this;
@ -100,6 +106,8 @@ namespace Grpc.Core
public Builder AddMethod<TRequest, TResponse>( public Builder AddMethod<TRequest, TResponse>(
Method<TRequest, TResponse> method, Method<TRequest, TResponse> method,
DuplexStreamingServerMethod<TRequest, TResponse> handler) DuplexStreamingServerMethod<TRequest, TResponse> handler)
where TRequest : class
where TResponse : class
{ {
callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.DuplexStreamingCall(method, handler)); callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.DuplexStreamingCall(method, handler));
return this; return this;

@ -64,6 +64,8 @@ namespace Grpc.Core
/// Creates a new call to given method. /// Creates a new call to given method.
/// </summary> /// </summary>
protected Call<TRequest, TResponse> CreateCall<TRequest, TResponse>(string serviceName, Method<TRequest, TResponse> method) protected Call<TRequest, TResponse> CreateCall<TRequest, TResponse>(string serviceName, Method<TRequest, TResponse> method)
where TRequest : class
where TResponse : class
{ {
var headerBuilder = Metadata.CreateBuilder(); var headerBuilder = Metadata.CreateBuilder();
config.HeaderInterceptor(headerBuilder); config.HeaderInterceptor(headerBuilder);

@ -46,7 +46,7 @@ namespace math
Server server = new Server(); Server server = new Server();
server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl())); server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl()));
int port = server.AddListeningPort(host + ":23456"); int port = server.AddListeningPort(host, 23456);
server.Start(); server.Start();
Console.WriteLine("MathServer listening on port " + port); Console.WriteLine("MathServer listening on port " + port);

@ -59,7 +59,7 @@ namespace math.Tests
server = new Server(); server = new Server();
server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl())); server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl()));
int port = server.AddListeningPort(host + ":0"); int port = server.AddListeningPort(host, Server.PickUnusedPort);
server.Start(); server.Start();
channel = new Channel(host + ":" + port); channel = new Channel(host + ":" + port);

@ -133,13 +133,13 @@ namespace math
// server-side interface // server-side interface
public interface IMathService public interface IMathService
{ {
Task<DivReply> Div(DivArgs request); Task<DivReply> Div(ServerCallContext context, DivArgs request);
Task Fib(FibArgs request, IServerStreamWriter<Num> responseStream); Task Fib(ServerCallContext context, FibArgs request, IServerStreamWriter<Num> responseStream);
Task<Num> Sum(IAsyncStreamReader<Num> requestStream); Task<Num> Sum(ServerCallContext context, IAsyncStreamReader<Num> requestStream);
Task DivMany(IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream); Task DivMany(ServerCallContext context, IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream);
} }
public static ServerServiceDefinition BindService(IMathService serviceImpl) public static ServerServiceDefinition BindService(IMathService serviceImpl)

@ -46,12 +46,12 @@ namespace math
/// </summary> /// </summary>
public class MathServiceImpl : MathGrpc.IMathService public class MathServiceImpl : MathGrpc.IMathService
{ {
public Task<DivReply> Div(DivArgs request) public Task<DivReply> Div(ServerCallContext context, DivArgs request)
{ {
return Task.FromResult(DivInternal(request)); return Task.FromResult(DivInternal(request));
} }
public async Task Fib(FibArgs request, IServerStreamWriter<Num> responseStream) public async Task Fib(ServerCallContext context, FibArgs request, IServerStreamWriter<Num> responseStream)
{ {
if (request.Limit <= 0) if (request.Limit <= 0)
{ {
@ -68,7 +68,7 @@ namespace math
} }
} }
public async Task<Num> Sum(IAsyncStreamReader<Num> requestStream) public async Task<Num> Sum(ServerCallContext context, IAsyncStreamReader<Num> requestStream)
{ {
long sum = 0; long sum = 0;
await requestStream.ForEach(async num => await requestStream.ForEach(async num =>
@ -78,7 +78,7 @@ namespace math
return Num.CreateBuilder().SetNum_(sum).Build(); return Num.CreateBuilder().SetNum_(sum).Build();
} }
public async Task DivMany(IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream) public async Task DivMany(ServerCallContext context, IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream)
{ {
await requestStream.ForEach(async divArgs => await requestStream.ForEach(async divArgs =>
{ {

@ -59,7 +59,7 @@ namespace Grpc.IntegrationTesting
server = new Server(); server = new Server();
server.AddServiceDefinition(TestServiceGrpc.BindService(new TestServiceImpl())); server.AddServiceDefinition(TestServiceGrpc.BindService(new TestServiceImpl()));
int port = server.AddListeningPort(host + ":0", TestCredentials.CreateTestServerCredentials()); int port = server.AddListeningPort(host, Server.PickUnusedPort, TestCredentials.CreateTestServerCredentials());
server.Start(); server.Start();
var channelArgs = ChannelArgs.CreateBuilder() var channelArgs = ChannelArgs.CreateBuilder()

@ -93,16 +93,17 @@ namespace Grpc.IntegrationTesting
var server = new Server(); var server = new Server();
server.AddServiceDefinition(TestServiceGrpc.BindService(new TestServiceImpl())); server.AddServiceDefinition(TestServiceGrpc.BindService(new TestServiceImpl()));
string addr = "0.0.0.0:" + options.port; string host = "0.0.0.0";
int port = options.port.Value;
if (options.useTls) if (options.useTls)
{ {
server.AddListeningPort(addr, TestCredentials.CreateTestServerCredentials()); server.AddListeningPort(host, port, TestCredentials.CreateTestServerCredentials());
} }
else else
{ {
server.AddListeningPort(addr); server.AddListeningPort(host, options.port.Value);
} }
Console.WriteLine("Running server on " + addr); Console.WriteLine("Running server on " + string.Format("{0}:{1}", host, port));
server.Start(); server.Start();
server.ShutdownTask.Wait(); server.ShutdownTask.Wait();

@ -171,17 +171,17 @@ namespace grpc.testing
// server-side interface // server-side interface
public interface ITestService public interface ITestService
{ {
Task<Empty> EmptyCall(Empty request); Task<Empty> EmptyCall(ServerCallContext context, Empty request);
Task<SimpleResponse> UnaryCall(SimpleRequest request); Task<SimpleResponse> UnaryCall(ServerCallContext context, SimpleRequest request);
Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter<StreamingOutputCallResponse> responseStream); Task StreamingOutputCall(ServerCallContext context, StreamingOutputCallRequest request, IServerStreamWriter<StreamingOutputCallResponse> responseStream);
Task<StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<StreamingInputCallRequest> requestStream); Task<StreamingInputCallResponse> StreamingInputCall(ServerCallContext context, IAsyncStreamReader<StreamingInputCallRequest> requestStream);
Task FullDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream); Task FullDuplexCall(ServerCallContext context, IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream);
Task HalfDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream); Task HalfDuplexCall(ServerCallContext context, IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream);
} }
public static ServerServiceDefinition BindService(ITestService serviceImpl) public static ServerServiceDefinition BindService(ITestService serviceImpl)

@ -46,19 +46,19 @@ namespace grpc.testing
/// </summary> /// </summary>
public class TestServiceImpl : TestServiceGrpc.ITestService public class TestServiceImpl : TestServiceGrpc.ITestService
{ {
public Task<Empty> EmptyCall(Empty request) public Task<Empty> EmptyCall(ServerCallContext context, Empty request)
{ {
return Task.FromResult(Empty.DefaultInstance); return Task.FromResult(Empty.DefaultInstance);
} }
public Task<SimpleResponse> UnaryCall(SimpleRequest request) public Task<SimpleResponse> UnaryCall(ServerCallContext context, SimpleRequest request)
{ {
var response = SimpleResponse.CreateBuilder() var response = SimpleResponse.CreateBuilder()
.SetPayload(CreateZerosPayload(request.ResponseSize)).Build(); .SetPayload(CreateZerosPayload(request.ResponseSize)).Build();
return Task.FromResult(response); return Task.FromResult(response);
} }
public async Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter<StreamingOutputCallResponse> responseStream) public async Task StreamingOutputCall(ServerCallContext context, StreamingOutputCallRequest request, IServerStreamWriter<StreamingOutputCallResponse> responseStream)
{ {
foreach (var responseParam in request.ResponseParametersList) foreach (var responseParam in request.ResponseParametersList)
{ {
@ -68,7 +68,7 @@ namespace grpc.testing
} }
} }
public async Task<StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<StreamingInputCallRequest> requestStream) public async Task<StreamingInputCallResponse> StreamingInputCall(ServerCallContext context, IAsyncStreamReader<StreamingInputCallRequest> requestStream)
{ {
int sum = 0; int sum = 0;
await requestStream.ForEach(async request => await requestStream.ForEach(async request =>
@ -78,7 +78,7 @@ namespace grpc.testing
return StreamingInputCallResponse.CreateBuilder().SetAggregatedPayloadSize(sum).Build(); return StreamingInputCallResponse.CreateBuilder().SetAggregatedPayloadSize(sum).Build();
} }
public async Task FullDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream) public async Task FullDuplexCall(ServerCallContext context, IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream)
{ {
await requestStream.ForEach(async request => await requestStream.ForEach(async request =>
{ {
@ -91,7 +91,7 @@ namespace grpc.testing
}); });
} }
public async Task HalfDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream) public async Task HalfDuplexCall(ServerCallContext context, IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

@ -18,4 +18,5 @@ missing
mkinstalldirs mkinstalldirs
ext/grpc/ltmain.sh ext/grpc/ltmain.sh
composer.lock
vendor/

315
src/php/composer.lock generated

@ -1,315 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "bb81ea5f72ddea2f594a172ff0f3b44d",
"packages": [
{
"name": "firebase/php-jwt",
"version": "2.0.0",
"target-dir": "Firebase/PHP-JWT",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"type": "library",
"autoload": {
"classmap": [
"Authentication/",
"Exceptions/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Neuman Vong",
"email": "neuman+pear@twilio.com",
"role": "Developer"
},
{
"name": "Anant Narayanan",
"email": "anant@php.net",
"role": "Developer"
}
],
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
"homepage": "https://github.com/firebase/php-jwt",
"time": "2015-04-01 18:46:38"
},
{
"name": "google/auth",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/google/google-auth-library-php.git",
"reference": "70ff1c9b27b1678827465c72ce81a067e1653442"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/google/google-auth-library-php/zipball/70ff1c9b27b1678827465c72ce81a067e1653442",
"reference": "70ff1c9b27b1678827465c72ce81a067e1653442",
"shasum": ""
},
"require": {
"firebase/php-jwt": "2.0.0",
"guzzlehttp/guzzle": "5.2.*",
"php": ">=5.4"
},
"require-dev": {
"phplint/phplint": "0.0.1",
"phpunit/phpunit": "3.7.*"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
],
"psr-4": {
"Google\\Auth\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"description": "Google Auth Library for PHP",
"homepage": "http://github.com/google/google-auth-library-php",
"keywords": [
"Authentication",
"google",
"oauth2"
],
"time": "2015-05-06 16:31:42"
},
{
"name": "guzzlehttp/guzzle",
"version": "5.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "475b29ccd411f2fa8a408e64576418728c032cfa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/475b29ccd411f2fa8a408e64576418728c032cfa",
"reference": "475b29ccd411f2fa8a408e64576418728c032cfa",
"shasum": ""
},
"require": {
"guzzlehttp/ringphp": "~1.0",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"time": "2015-01-28 01:03:29"
},
{
"name": "guzzlehttp/ringphp",
"version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/guzzle/RingPHP.git",
"reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/52d868f13570a9a56e5fce6614e0ec75d0f13ac2",
"reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2",
"shasum": ""
},
"require": {
"guzzlehttp/streams": "~3.0",
"php": ">=5.4.0",
"react/promise": "~2.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Ring\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
"time": "2015-03-30 01:43:20"
},
{
"name": "guzzlehttp/streams",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/streams.git",
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Stream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Provides a simple abstraction over streams of data",
"homepage": "http://guzzlephp.org/",
"keywords": [
"Guzzle",
"stream"
],
"time": "2014-10-12 19:18:40"
},
{
"name": "react/promise",
"version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise.git",
"reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/365fcee430dfa4ace1fbc75737ca60ceea7eeeef",
"reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"React\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@googlemail.com"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
"time": "2014-12-30 13:32:42"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"google/auth": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.5.0"
},
"platform-dev": []
}

@ -65,15 +65,16 @@ END2END_TESTS = {
'max_message_length': True, 'max_message_length': True,
'no_op': True, 'no_op': True,
'ping_pong_streaming': True, 'ping_pong_streaming': True,
'registered_call': True,
'request_response_with_binary_metadata_and_payload': True, 'request_response_with_binary_metadata_and_payload': True,
'request_response_with_metadata_and_payload': True, 'request_response_with_metadata_and_payload': True,
'request_response_with_payload': True, 'request_response_with_payload': True,
'request_response_with_trailing_metadata_and_payload': True,
'request_with_large_metadata': True, 'request_with_large_metadata': True,
'request_with_payload': True, 'request_with_payload': True,
'simple_delayed_request': True, 'simple_delayed_request': True,
'simple_request': True, 'simple_request': True,
'simple_request_with_high_initial_sequence_number': True, 'simple_request_with_high_initial_sequence_number': True,
'registered_call': True,
} }

@ -114,9 +114,9 @@ static void test_request_response_with_metadata_and_payload(
grpc_byte_buffer *response_payload = grpc_byte_buffer *response_payload =
grpc_byte_buffer_create(&response_payload_slice, 1); grpc_byte_buffer_create(&response_payload_slice, 1);
gpr_timespec deadline = five_seconds_time(); gpr_timespec deadline = five_seconds_time();
grpc_metadata meta_c[2] = {{"key1", "val1", 4}, {"key2", "val2", 4}}; grpc_metadata meta_c[2] = {{"key1", "val1", 4, {{NULL, NULL, NULL}}}, {"key2", "val2", 4, {{NULL, NULL, NULL}}}};
grpc_metadata meta_s[2] = {{"key3", "val3", 4}, {"key4", "val4", 4}}; grpc_metadata meta_s[2] = {{"key3", "val3", 4, {{NULL, NULL, NULL}}}, {"key4", "val4", 4, {{NULL, NULL, NULL}}}};
grpc_metadata meta_t[2] = {{"key5", "val5", 4}, {"key6", "val6", 4}}; grpc_metadata meta_t[2] = {{"key5", "val5", 4, {{NULL, NULL, NULL}}}, {"key6", "val6", 4, {{NULL, NULL, NULL}}}};
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL); grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_client = cq_verifier_create(f.client_cq);
cq_verifier *v_server = cq_verifier_create(f.server_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq);
@ -205,7 +205,6 @@ static void test_request_response_with_metadata_and_payload(
GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
GPR_ASSERT(was_cancelled == 1);
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world"));
GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you"));
GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1"));

@ -49,10 +49,6 @@ static int seed(void) { return _getpid(); }
#endif #endif
void grpc_test_init(int argc, char **argv) { void grpc_test_init(int argc, char **argv) {
#ifndef GPR_WIN32
/* disable SIGPIPE */
signal(SIGPIPE, SIG_IGN);
#endif
gpr_log(GPR_DEBUG, "test slowdown: machine=%f build=%f total=%f", gpr_log(GPR_DEBUG, "test slowdown: machine=%f build=%f total=%f",
GRPC_TEST_SLOWDOWN_MACHINE_FACTOR, GRPC_TEST_SLOWDOWN_BUILD_FACTOR, GRPC_TEST_SLOWDOWN_MACHINE_FACTOR, GRPC_TEST_SLOWDOWN_BUILD_FACTOR,
GRPC_TEST_SLOWDOWN_FACTOR); GRPC_TEST_SLOWDOWN_FACTOR);

@ -138,7 +138,6 @@ static void RunQPS() {
} // namespace grpc } // namespace grpc
int main(int argc, char** argv) { int main(int argc, char** argv) {
signal(SIGPIPE, SIG_IGN);
using namespace grpc::testing; using namespace grpc::testing;
RunSynchronousStreamingPingPong(); RunSynchronousStreamingPingPong();
RunSynchronousUnaryPingPong(); RunSynchronousUnaryPingPong();

@ -34,7 +34,7 @@ RUN git clone --recursive --depth 1 https://github.com/grpc/grpc-java.git /var/l
RUN cd /var/local/git/grpc-java/lib/netty && \ RUN cd /var/local/git/grpc-java/lib/netty && \
mvn -pl codec-http2 -am -DskipTests install clean mvn -pl codec-http2 -am -DskipTests install clean
RUN cd /var/local/git/grpc-java && \ RUN cd /var/local/git/grpc-java && \
./gradlew build ./gradlew build installDist
# Specify the default command such that the interop server runs on its known testing port # Specify the default command such that the interop server runs on its known testing port
CMD ["/var/local/git/grpc-java/run-test-server.sh", "--use_tls=true", "--port=8030"] CMD ["/var/local/git/grpc-java/run-test-server.sh", "--use_tls=true", "--port=8030"]

@ -4,6 +4,6 @@ cp -R /var/local/git-clone /var/local/git
cd /var/local/git/grpc-java/lib/netty && \ cd /var/local/git/grpc-java/lib/netty && \
mvn -pl codec-http2 -am -DskipTests install clean mvn -pl codec-http2 -am -DskipTests install clean
cd /var/local/git/grpc-java && \ cd /var/local/git/grpc-java && \
./gradlew build ./gradlew build installDist
echo 'build finished' echo 'build finished'

@ -882,6 +882,15 @@
"posix" "posix"
] ]
}, },
{
"flaky": false,
"language": "c",
"name": "chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{ {
"flaky": false, "flaky": false,
"language": "c", "language": "c",
@ -1116,6 +1125,15 @@
"posix" "posix"
] ]
}, },
{
"flaky": false,
"language": "c",
"name": "chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{ {
"flaky": false, "flaky": false,
"language": "c", "language": "c",
@ -1350,6 +1368,15 @@
"posix" "posix"
] ]
}, },
{
"flaky": false,
"language": "c",
"name": "chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{ {
"flaky": false, "flaky": false,
"language": "c", "language": "c",
@ -1584,6 +1611,15 @@
"posix" "posix"
] ]
}, },
{
"flaky": false,
"language": "c",
"name": "chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{ {
"flaky": false, "flaky": false,
"language": "c", "language": "c",
@ -1818,6 +1854,15 @@
"posix" "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, "flaky": false,
"language": "c", "language": "c",
@ -2052,6 +2097,15 @@
"posix" "posix"
] ]
}, },
{
"flaky": false,
"language": "c",
"name": "chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test",
"platforms": [
"windows",
"posix"
]
},
{ {
"flaky": false, "flaky": false,
"language": "c", "language": "c",
@ -2286,6 +2340,15 @@
"posix" "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, "flaky": false,
"language": "c", "language": "c",
@ -2520,6 +2583,15 @@
"posix" "posix"
] ]
}, },
{
"flaky": false,
"language": "c",
"name": "chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test",
"platforms": [
"windows",
"posix"
]
},
{ {
"flaky": false, "flaky": false,
"language": "c", "language": "c",
@ -2754,6 +2826,15 @@
"posix" "posix"
] ]
}, },
{
"flaky": false,
"language": "c",
"name": "chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test",
"platforms": [
"windows",
"posix"
]
},
{ {
"flaky": false, "flaky": false,
"language": "c", "language": "c",
@ -2988,6 +3069,15 @@
"posix" "posix"
] ]
}, },
{
"flaky": false,
"language": "c",
"name": "chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test",
"platforms": [
"windows",
"posix"
]
},
{ {
"flaky": false, "flaky": false,
"language": "c", "language": "c",
@ -3222,6 +3312,15 @@
"posix" "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, "flaky": false,
"language": "c", "language": "c",

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save