Merge pull request #40 from nicolasnoble/vsprojects
Factoring visual studio code into a buildgen plugin.
diff --git a/INSTALL b/INSTALL
index 48511af..bba923c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -58,7 +58,7 @@
The recommended version of OpenSSL that provides ALPN support is available
at this URL:
- https://www.openssl.org/source/openssl-1.0.2-beta3.tar.gz
+ https://www.openssl.org/source/openssl-1.0.2.tar.gz
Dependencies to compile and run the tests
@@ -101,7 +101,7 @@
Secure HTTP2 requires to have the TLS extension ALPN (see rfc 7301 and
http://http2.github.io/http2-spec/ section 3.3). Our HTTP2 implementation
-relies on OpenSSL's implementation. OpenSSL 1.0.2beta3 is the first version
+relies on OpenSSL's implementation. OpenSSL 1.0.2 is the first released version
of OpenSSL that has ALPN support, and this explains our dependency on it.
Note that the Makefile supports compiling only the unsecure elements of grpc,
diff --git a/Makefile b/Makefile
index 14b708f..1d1aff2 100644
--- a/Makefile
+++ b/Makefile
@@ -1395,6 +1395,7 @@
src/core/iomgr/pollset_kick_posix.c \
src/core/iomgr/pollset_multipoller_with_poll_posix.c \
src/core/iomgr/pollset_posix.c \
+ src/core/iomgr/pollset_windows.c \
src/core/iomgr/resolve_address_posix.c \
src/core/iomgr/sockaddr_utils.c \
src/core/iomgr/socket_utils_common_posix.c \
@@ -1513,6 +1514,7 @@
src/core/iomgr/pollset_kick_posix.c: $(OPENSSL_DEP)
src/core/iomgr/pollset_multipoller_with_poll_posix.c: $(OPENSSL_DEP)
src/core/iomgr/pollset_posix.c: $(OPENSSL_DEP)
+src/core/iomgr/pollset_windows.c: $(OPENSSL_DEP)
src/core/iomgr/resolve_address_posix.c: $(OPENSSL_DEP)
src/core/iomgr/sockaddr_utils.c: $(OPENSSL_DEP)
src/core/iomgr/socket_utils_common_posix.c: $(OPENSSL_DEP)
@@ -1652,6 +1654,7 @@
objs/$(CONFIG)/src/core/iomgr/pollset_kick_posix.o:
objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_poll_posix.o:
objs/$(CONFIG)/src/core/iomgr/pollset_posix.o:
+objs/$(CONFIG)/src/core/iomgr/pollset_windows.o:
objs/$(CONFIG)/src/core/iomgr/resolve_address_posix.o:
objs/$(CONFIG)/src/core/iomgr/sockaddr_utils.o:
objs/$(CONFIG)/src/core/iomgr/socket_utils_common_posix.o:
@@ -1811,6 +1814,7 @@
src/core/iomgr/pollset_kick_posix.c \
src/core/iomgr/pollset_multipoller_with_poll_posix.c \
src/core/iomgr/pollset_posix.c \
+ src/core/iomgr/pollset_windows.c \
src/core/iomgr/resolve_address_posix.c \
src/core/iomgr/sockaddr_utils.c \
src/core/iomgr/socket_utils_common_posix.c \
@@ -1933,6 +1937,7 @@
objs/$(CONFIG)/src/core/iomgr/pollset_kick_posix.o:
objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_poll_posix.o:
objs/$(CONFIG)/src/core/iomgr/pollset_posix.o:
+objs/$(CONFIG)/src/core/iomgr/pollset_windows.o:
objs/$(CONFIG)/src/core/iomgr/resolve_address_posix.o:
objs/$(CONFIG)/src/core/iomgr/sockaddr_utils.o:
objs/$(CONFIG)/src/core/iomgr/socket_utils_common_posix.o:
@@ -2210,7 +2215,11 @@
libs/$(CONFIG)/libtips_client_lib.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIBTIPS_CLIENT_LIB_OBJS)
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
+ $(Q) rm -f libs/$(CONFIG)/libtips_client_lib.a
$(Q) $(AR) rcs libs/$(CONFIG)/libtips_client_lib.a $(LIBTIPS_CLIENT_LIB_OBJS)
+ifeq ($(SYSTEM),Darwin)
+ $(Q) ranlib libs/$(CONFIG)/libtips_client_lib.a
+endif
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..fa39d3b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,73 @@
+[gRPC - An RPC library and framework](http://github.com/google/grpc)
+===================================
+
+Copyright 2015 Google Inc.
+
+#Installation
+
+See grpc/INSTALL for installation instructions for various platforms.
+
+#Overview
+
+
+Remote Procedure Calls (RPCs) provide a useful abstraction for building
+distributed applications and services. The libraries in this repository
+provide a concrete implementation of the gRPC protocol, layered over HTTP/2.
+These libraries enable communication between clients and servers using any
+combination of the supported languages.
+
+
+##Interface
+
+
+Developers using gRPC typically start with the description of an RPC service
+(a collection of methods), and generate client and server side interfaces
+which they use on the client-side and implement on the server side.
+
+By default, gRPC uses [Protocol Buffers](github.com/google/protobuf) as the
+Interface Definition Language (IDL) for describing both the service interface
+and the structure of the payload messages. It is possible to use other
+alternatives if desired.
+
+###Surface API
+Starting from an interface definition in a .proto file, gRPC provides
+Protocol Compiler plugins that generate Client- and Server-side APIs.
+gRPC users typically call into these APIs on the Client side and implement
+the corresponding API on the server side.
+
+#### Synchronous vs. asynchronous
+Synchronous RPC calls, that block until a response arrives from the server, are
+the closest approximation to the abstraction of a procedure call that RPC
+aspires to.
+
+On the other hand, networks are inherently asynchronous and in many scenarios,
+it is desirable to have the ability to start RPCs without blocking the current
+thread.
+
+The gRPC programming surface in most languages comes in both synchronous and
+asynchronous flavors.
+
+
+## Streaming
+
+gRPC supports streaming semantics, where either the client or the server (or both)
+send a stream of messages on a single RPC call. The most general case is
+Bidirectional Streaming where a single gRPC call establishes a stream where both
+the client and the server can send a stream of messages to each other. The streamed
+messages are delivered in the order they were sent.
+
+
+#Protocol
+
+The gRPC protocol specifies the abstract requirements for communication between
+clients and servers. A concrete embedding over HTTP/2 completes the picture by
+fleshing out the details of each of the required operations.
+
+## Abstract gRPC protocol
+A gRPC RPC comprises of a bidirectional stream of messages, initiated by the client. In the client-to-server direction, this stream begins with a mandatory `Call Header`, followed by optional `Initial-Metadata`, followed by zero or more `Payload Messages`. The server-to-client direction contains an optional `Initial-Metadata`, followed by zero or more `Payload Messages` terminated with a mandatory `Status` and optional `Status-Metadata` (a.k.a.,`Trailing-Metadata`).
+
+## Implementation over HTTP/2
+The abstract protocol defined above is implemented over [HTTP/2](https://http2.github.io/). gRPC bidirectional streams are mapped to HTTP/2 streams. The contents of `Call Header` and `Initial Metadata` are sent as HTTP/2 headers and subject to HPAC compression. `Payload Messages` are serialized into a byte stream of length prefixed gRPC frames which are then fragmented into HTTP/2 frames at the sender and reassembled at the receiver. `Status` and `Trailing-Metadata` are sent as HTTP/2 trailing headers (a.k.a., trailers).
+
+## Flow Control
+gRPC inherits the flow control mchanims in HTTP/2 and uses them to enable fine-grained control of the amount of memory used for buffering in-flight messages.
diff --git a/build.json b/build.json
index 31bec6c..cacbfe2 100644
--- a/build.json
+++ b/build.json
@@ -48,7 +48,9 @@
"src/core/iomgr/pollset.h",
"src/core/iomgr/pollset_kick.h",
"src/core/iomgr/pollset_kick_posix.h",
+ "src/core/iomgr/pollset_kick_windows.h",
"src/core/iomgr/pollset_posix.h",
+ "src/core/iomgr/pollset_windows.h",
"src/core/iomgr/resolve_address.h",
"src/core/iomgr/sockaddr.h",
"src/core/iomgr/sockaddr_posix.h",
@@ -126,6 +128,7 @@
"src/core/iomgr/pollset_kick_posix.c",
"src/core/iomgr/pollset_multipoller_with_poll_posix.c",
"src/core/iomgr/pollset_posix.c",
+ "src/core/iomgr/pollset_windows.c",
"src/core/iomgr/resolve_address_posix.c",
"src/core/iomgr/sockaddr_utils.c",
"src/core/iomgr/socket_utils_common_posix.c",
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h
index f03f61d..6c8b168 100644
--- a/include/grpc/grpc.h
+++ b/include/grpc/grpc.h
@@ -158,6 +158,7 @@
/* Sample helpers to obtain byte buffers (these will certainly move place */
grpc_byte_buffer *grpc_byte_buffer_create(gpr_slice *slices, size_t nslices);
+grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb);
size_t grpc_byte_buffer_length(grpc_byte_buffer *bb);
void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer);
@@ -313,18 +314,14 @@
flags is a bit-field combination of the write flags defined above.
REQUIRES: Can be called at most once per call.
Can only be called on the client.
- Produces a GRPC_INVOKE_ACCEPTED event with invoke_accepted_tag when the
- call has been invoked (meaning bytes can start flowing to the wire).
Produces a GRPC_CLIENT_METADATA_READ event with metadata_read_tag when
the servers initial metadata has been read.
Produces a GRPC_FINISHED event with finished_tag when the call has been
completed (there may be other events for the call pending at this
time) */
-grpc_call_error grpc_call_start_invoke(grpc_call *call,
- grpc_completion_queue *cq,
- void *invoke_accepted_tag,
- void *metadata_read_tag,
- void *finished_tag, gpr_uint32 flags);
+grpc_call_error grpc_call_invoke(grpc_call *call, grpc_completion_queue *cq,
+ void *metadata_read_tag, void *finished_tag,
+ gpr_uint32 flags);
/* Accept an incoming RPC, binding a completion queue to it.
To be called before sending or receiving messages.
diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h
index 05a5bbe..118a919 100644
--- a/include/grpc/support/port_platform.h
+++ b/include/grpc/support/port_platform.h
@@ -132,6 +132,14 @@
#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32
#endif
+#if defined(GPR_POSIX_MULTIPOLL_WITH_POLL) && !defined(GPR_POSIX_SOCKET)
+#error Must define GPR_POSIX_SOCKET to use GPR_POSIX_MULTIPOLL_WITH_POLL
+#endif
+
+#if defined(GPR_POSIX_SOCKET) + defined(GPR_WIN32) != 1
+#error Must define exactly one of GPR_POSIX_POLLSET, GPR_WIN32
+#endif
+
typedef int16_t gpr_int16;
typedef int32_t gpr_int32;
typedef int64_t gpr_int64;
diff --git a/src/core/channel/call_op_string.c b/src/core/channel/call_op_string.c
index 9a7838c..7899139 100644
--- a/src/core/channel/call_op_string.c
+++ b/src/core/channel/call_op_string.c
@@ -37,8 +37,8 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
-#include <grpc/support/string.h>
#include <grpc/support/useful.h>
#define MAX_APPEND 1024
diff --git a/src/core/channel/channel_args.c b/src/core/channel/channel_args.c
index 36312e5..04ce519 100644
--- a/src/core/channel/channel_args.c
+++ b/src/core/channel/channel_args.c
@@ -33,9 +33,9 @@
#include <grpc/grpc.h>
#include "src/core/channel/channel_args.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
-#include <grpc/support/string.h>
#include <string.h>
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c
index fa75561..f9b42db 100644
--- a/src/core/channel/client_channel.c
+++ b/src/core/channel/client_channel.c
@@ -40,9 +40,9 @@
#include "src/core/channel/connected_channel.h"
#include "src/core/channel/metadata_buffer.h"
#include "src/core/iomgr/iomgr.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
@@ -410,7 +410,7 @@
grpc_mdctx *metadata_context, int is_first,
int is_last) {
channel_data *chand = elem->channel_data;
- char temp[16];
+ char temp[GPR_LTOA_MIN_BUFSIZE];
GPR_ASSERT(!is_first);
GPR_ASSERT(is_last);
@@ -425,7 +425,7 @@
chand->transport_setup_initiated = 0;
chand->args = grpc_channel_args_copy(args);
- sprintf(temp, "%d", GRPC_STATUS_CANCELLED);
+ gpr_ltoa(GRPC_STATUS_CANCELLED, temp);
chand->cancel_status =
grpc_mdelem_from_strings(metadata_context, "grpc-status", temp);
}
diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c
index e01cb81..47c0ed3 100644
--- a/src/core/channel/connected_channel.c
+++ b/src/core/channel/connected_channel.c
@@ -37,12 +37,12 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/support/string.h"
#include "src/core/transport/transport.h"
#include <grpc/byte_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
-#include <grpc/support/string.h>
#define MAX_BUFFER_LENGTH 8192
/* the protobuf library will (by default) start warning at 100megs */
@@ -384,23 +384,25 @@
case GRPC_OP_BEGIN_MESSAGE:
/* can't begin a message when we're still reading a message */
if (calld->reading_message) {
- char message[128];
- sprintf(message,
- "Message terminated early; read %d bytes, expected %d",
- (int)calld->incoming_message.length,
- (int)calld->incoming_message_length);
+ char *message = NULL;
+ gpr_asprintf(&message,
+ "Message terminated early; read %d bytes, expected %d",
+ (int)calld->incoming_message.length,
+ (int)calld->incoming_message_length);
recv_error(chand, calld, __LINE__, message);
+ gpr_free(message);
return;
}
/* stash away parameters, and prepare for incoming slices */
length = stream_op->data.begin_message.length;
if (length > calld->max_message_length) {
- char message[128];
- sprintf(
- message,
+ char *message = NULL;
+ gpr_asprintf(
+ &message,
"Maximum message length of %d exceeded by a message of length %d",
calld->max_message_length, length);
recv_error(chand, calld, __LINE__, message);
+ gpr_free(message);
} else if (length > 0) {
calld->reading_message = 1;
calld->incoming_message_length = length;
@@ -423,12 +425,13 @@
gpr_slice_buffer_add(&calld->incoming_message, stream_op->data.slice);
if (calld->incoming_message.length > calld->incoming_message_length) {
/* if we got too many bytes, complain */
- char message[128];
- sprintf(message,
- "Receiving message overflow; read %d bytes, expected %d",
- (int)calld->incoming_message.length,
- (int)calld->incoming_message_length);
+ char *message = NULL;
+ gpr_asprintf(&message,
+ "Receiving message overflow; read %d bytes, expected %d",
+ (int)calld->incoming_message.length,
+ (int)calld->incoming_message_length);
recv_error(chand, calld, __LINE__, message);
+ gpr_free(message);
return;
} else if (calld->incoming_message.length ==
calld->incoming_message_length) {
@@ -441,10 +444,11 @@
final_state == GRPC_STREAM_CLOSED)) {
calld->got_read_close = 1;
if (calld->reading_message) {
- char message[128];
- sprintf(message, "Last message truncated; read %d bytes, expected %d",
- (int)calld->incoming_message.length,
- (int)calld->incoming_message_length);
+ char *message = NULL;
+ gpr_asprintf(&message,
+ "Last message truncated; read %d bytes, expected %d",
+ (int)calld->incoming_message.length,
+ (int)calld->incoming_message_length);
recv_error(chand, calld, __LINE__, message);
}
call_op.type = GRPC_RECV_HALF_CLOSE;
diff --git a/src/core/httpcli/httpcli.c b/src/core/httpcli/httpcli.c
index 2143eeb..d6fd8ca 100644
--- a/src/core/httpcli/httpcli.c
+++ b/src/core/httpcli/httpcli.c
@@ -44,9 +44,9 @@
#include "src/core/security/security_context.h"
#include "src/core/security/google_root_certs.h"
#include "src/core/security/secure_transport_setup.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
typedef struct {
gpr_slice request_text;
diff --git a/src/core/httpcli/httpcli_security_context.c b/src/core/httpcli/httpcli_security_context.c
index c7b9b33..d074e16 100644
--- a/src/core/httpcli/httpcli_security_context.c
+++ b/src/core/httpcli/httpcli_security_context.c
@@ -36,9 +36,9 @@
#include <string.h>
#include "src/core/security/secure_transport_setup.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include "src/core/tsi/ssl_transport_security.h"
typedef struct {
diff --git a/src/core/iomgr/endpoint_pair_posix.c b/src/core/iomgr/endpoint_pair_posix.c
index f08d134..3f53402 100644
--- a/src/core/iomgr/endpoint_pair_posix.c
+++ b/src/core/iomgr/endpoint_pair_posix.c
@@ -31,6 +31,10 @@
*
*/
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_POSIX_SOCKET
+
#include "src/core/iomgr/endpoint_pair.h"
#include <errno.h>
@@ -59,3 +63,5 @@
p.server = grpc_tcp_create(grpc_fd_create(sv[0]), read_slice_size);
return p;
}
+
+#endif
diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c
index 3cd2f9a..9f70a26 100644
--- a/src/core/iomgr/fd_posix.c
+++ b/src/core/iomgr/fd_posix.c
@@ -31,6 +31,10 @@
*
*/
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_POSIX_SOCKET
+
#include "src/core/iomgr/fd_posix.h"
#include <assert.h>
@@ -272,3 +276,5 @@
void grpc_fd_become_writable(grpc_fd *fd, int allow_synchronous_callback) {
set_ready(fd, &fd->writest, allow_synchronous_callback);
}
+
+#endif
diff --git a/src/core/iomgr/pollset.h b/src/core/iomgr/pollset.h
index 36d80d5..b9fcf45 100644
--- a/src/core/iomgr/pollset.h
+++ b/src/core/iomgr/pollset.h
@@ -48,6 +48,10 @@
#include "src/core/iomgr/pollset_posix.h"
#endif
+#ifdef GPR_WIN32
+#include "src/core/iomgr/pollset_windows.h"
+#endif
+
void grpc_pollset_init(grpc_pollset *pollset);
void grpc_pollset_destroy(grpc_pollset *pollset);
diff --git a/src/core/iomgr/pollset_kick.h b/src/core/iomgr/pollset_kick.h
index f088818..02f3e41 100644
--- a/src/core/iomgr/pollset_kick.h
+++ b/src/core/iomgr/pollset_kick.h
@@ -41,8 +41,10 @@
#ifdef GPR_POSIX_SOCKET
#include "src/core/iomgr/pollset_kick_posix.h"
-#else
-#error "No pollset kick support on platform"
+#endif
+
+#ifdef GPR_WIN32
+#include "src/core/iomgr/pollset_kick_windows.h"
#endif
void grpc_pollset_kick_global_init(void);
diff --git a/src/core/iomgr/pollset_kick_posix.c b/src/core/iomgr/pollset_kick_posix.c
index 9f85b61..4386cf5 100644
--- a/src/core/iomgr/pollset_kick_posix.c
+++ b/src/core/iomgr/pollset_kick_posix.c
@@ -31,6 +31,10 @@
*
*/
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_POSIX_SOCKET
+
#include "src/core/iomgr/pollset_kick_posix.h"
#include <errno.h>
@@ -175,3 +179,5 @@
}
gpr_mu_unlock(&kick_state->mu);
}
+
+#endif
diff --git a/src/core/iomgr/pollset_kick_windows.h b/src/core/iomgr/pollset_kick_windows.h
new file mode 100644
index 0000000..243e519
--- /dev/null
+++ b/src/core/iomgr/pollset_kick_windows.h
@@ -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.
+ *
+ */
+
+#ifndef __GRPC_INTERNAL_IOMGR_POLLSET_KICK_WINDOWS_H_
+#define __GRPC_INTERNAL_IOMGR_POLLSET_KICK_WINDOWS_H_
+
+#include <grpc/support/sync.h>
+
+struct grpc_kick_pipe_info;
+
+typedef struct grpc_pollset_kick_state {
+ int unused;
+} grpc_pollset_kick_state;
+
+#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_KICK_WINDOWS_H_ */
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 2555322..39e2dc4 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -31,6 +31,10 @@
*
*/
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_POSIX_SOCKET
+
#include "src/core/iomgr/pollset_posix.h"
#include <errno.h>
@@ -288,3 +292,5 @@
pollset->data.ptr = fd;
grpc_fd_ref(fd);
}
+
+#endif /* GPR_POSIX_POLLSET */
diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c
new file mode 100644
index 0000000..3fb3991
--- /dev/null
+++ b/src/core/iomgr/pollset_windows.c
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright 2014, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_WIN32
+
+#endif /* GPR_WIN32 */
diff --git a/src/core/iomgr/pollset_windows.h b/src/core/iomgr/pollset_windows.h
new file mode 100644
index 0000000..53b9ffa
--- /dev/null
+++ b/src/core/iomgr/pollset_windows.h
@@ -0,0 +1,54 @@
+/*
+ *
+ * Copyright 2014, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __GRPC_INTERNAL_IOMGR_POLLSET_WINDOWS_H_
+#define __GRPC_INTERNAL_IOMGR_POLLSET_WINDOWS_H_
+
+#include <grpc/support/sync.h>
+
+#include "src/core/iomgr/pollset_kick.h"
+
+/* forward declare only in this file to avoid leaking impl details via
+ pollset.h; real users of grpc_fd should always include 'fd_posix.h' and not
+ use the struct tag */
+struct grpc_fd;
+
+typedef struct grpc_pollset {
+ gpr_mu mu;
+ gpr_cv cv;
+} grpc_pollset;
+
+#define GRPC_POLLSET_MU(pollset) (&(pollset)->mu)
+#define GRPC_POLLSET_CV(pollset) (&(pollset)->cv)
+
+#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_WINDOWS_H_ */
diff --git a/src/core/iomgr/resolve_address.h b/src/core/iomgr/resolve_address.h
index 37ec0f0..7b537b1 100644
--- a/src/core/iomgr/resolve_address.h
+++ b/src/core/iomgr/resolve_address.h
@@ -34,10 +34,12 @@
#ifndef __GRPC_INTERNAL_IOMGR_RESOLVE_ADDRESS_H__
#define __GRPC_INTERNAL_IOMGR_RESOLVE_ADDRESS_H__
-#include <sys/socket.h>
+#include <stddef.h>
+
+#define GRPC_MAX_SOCKADDR_SIZE 128
typedef struct {
- struct sockaddr_storage addr;
+ char addr[GRPC_MAX_SOCKADDR_SIZE];
int len;
} grpc_resolved_address;
diff --git a/src/core/iomgr/resolve_address_posix.c b/src/core/iomgr/resolve_address_posix.c
index c9c2c53..f80eea7 100644
--- a/src/core/iomgr/resolve_address_posix.c
+++ b/src/core/iomgr/resolve_address_posix.c
@@ -44,9 +44,9 @@
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/sockaddr_utils.h"
#include "src/core/iomgr/socket_utils_posix.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
diff --git a/src/core/iomgr/sockaddr_utils.c b/src/core/iomgr/sockaddr_utils.c
index eca14a4..5bb1124 100644
--- a/src/core/iomgr/sockaddr_utils.c
+++ b/src/core/iomgr/sockaddr_utils.c
@@ -37,8 +37,8 @@
#include <errno.h>
#include <string.h>
+#include "src/core/support/string.h"
#include <grpc/support/host_port.h>
-#include <grpc/support/string.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
diff --git a/src/core/iomgr/socket_utils_common_posix.c b/src/core/iomgr/socket_utils_common_posix.c
index bd29e2b..1854285 100644
--- a/src/core/iomgr/socket_utils_common_posix.c
+++ b/src/core/iomgr/socket_utils_common_posix.c
@@ -31,6 +31,10 @@
*
*/
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_POSIX_SOCKET
+
#include "src/core/iomgr/socket_utils_posix.h"
#include <arpa/inet.h>
@@ -46,8 +50,8 @@
#include <errno.h>
#include "src/core/iomgr/sockaddr_utils.h"
+#include "src/core/support/string.h"
#include <grpc/support/host_port.h>
-#include <grpc/support/string.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
@@ -187,3 +191,5 @@
*dsmode = family == AF_INET ? GRPC_DSMODE_IPV4 : GRPC_DSMODE_NONE;
return socket(family, type, protocol);
}
+
+#endif
diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c
index d675c2d..851530c 100644
--- a/src/core/iomgr/tcp_client_posix.c
+++ b/src/core/iomgr/tcp_client_posix.c
@@ -31,6 +31,10 @@
*
*/
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_POSIX_SOCKET
+
#include "src/core/iomgr/tcp_client.h"
#include <errno.h>
@@ -229,3 +233,5 @@
grpc_alarm_init(&ac->alarm, deadline, on_alarm, ac, gpr_now());
grpc_fd_notify_on_write(ac->fd, on_writable, ac);
}
+
+#endif
diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c
index 657f34a..a9b59df 100644
--- a/src/core/iomgr/tcp_posix.c
+++ b/src/core/iomgr/tcp_posix.c
@@ -31,6 +31,10 @@
*
*/
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_POSIX_SOCKET
+
#include "src/core/iomgr/tcp_posix.h"
#include <errno.h>
@@ -40,10 +44,10 @@
#include <sys/socket.h>
#include <unistd.h>
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice.h>
-#include <grpc/support/string.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
@@ -539,3 +543,5 @@
tcp->em_fd = em_fd;
return &tcp->base;
}
+
+#endif
diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h
index 8ffd7d3..c4d836e 100644
--- a/src/core/iomgr/tcp_server.h
+++ b/src/core/iomgr/tcp_server.h
@@ -34,9 +34,6 @@
#ifndef __GRPC_INTERNAL_IOMGR_TCP_SERVER_H__
#define __GRPC_INTERNAL_IOMGR_TCP_SERVER_H__
-#include <sys/types.h>
-#include <sys/socket.h>
-
#include "src/core/iomgr/endpoint.h"
/* Forward decl of grpc_tcp_server */
@@ -63,7 +60,7 @@
For raw access to the underlying sockets, see grpc_tcp_server_get_fd(). */
/* TODO(ctiller): deprecate this, and make grpc_tcp_server_add_ports to handle
all of the multiple socket port matching logic in one place */
-int grpc_tcp_server_add_port(grpc_tcp_server *s, const struct sockaddr *addr,
+int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
int addr_len);
/* Returns the file descriptor of the Nth listening socket on this server,
diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c
index e6c0218..2d6c6a7 100644
--- a/src/core/iomgr/tcp_server_posix.c
+++ b/src/core/iomgr/tcp_server_posix.c
@@ -31,6 +31,10 @@
*
*/
+#include <grpc/support/port_platform.h>
+
+#ifdef GPR_POSIX_SOCKET
+
#define _GNU_SOURCE
#include "src/core/iomgr/tcp_server.h"
@@ -265,7 +269,7 @@
return port;
}
-int grpc_tcp_server_add_port(grpc_tcp_server *s, const struct sockaddr *addr,
+int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
int addr_len) {
int allocated_port1 = -1;
int allocated_port2 = -1;
@@ -364,3 +368,5 @@
}
gpr_mu_unlock(&s->mu);
}
+
+#endif
diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c
index 628963e..2f75556 100644
--- a/src/core/security/credentials.c
+++ b/src/core/security/credentials.c
@@ -36,9 +36,9 @@
#include "src/core/httpcli/httpcli.h"
#include "src/core/iomgr/iomgr.h"
#include "src/core/security/json_token.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
@@ -157,7 +157,7 @@
if (c->config.pem_private_keys[i] != NULL) {
gpr_free(c->config.pem_private_keys[i]);
}
- if (c->config.pem_cert_chains[i]!= NULL) {
+ if (c->config.pem_cert_chains[i] != NULL) {
gpr_free(c->config.pem_cert_chains[i]);
}
}
@@ -354,7 +354,6 @@
cJSON *access_token = NULL;
cJSON *token_type = NULL;
cJSON *expires_in = NULL;
- size_t new_access_token_size = 0;
json = cJSON_Parse(null_terminated_body);
if (json == NULL) {
gpr_log(GPR_ERROR, "Could not parse JSON from %s", null_terminated_body);
@@ -384,12 +383,8 @@
status = GRPC_CREDENTIALS_ERROR;
goto end;
}
- new_access_token_size = strlen(token_type->valuestring) + 1 +
- strlen(access_token->valuestring) + 1;
- new_access_token = gpr_malloc(new_access_token_size);
- /* C89 does not have snprintf :(. */
- sprintf(new_access_token, "%s %s", token_type->valuestring,
- access_token->valuestring);
+ gpr_asprintf(&new_access_token, "%s %s", token_type->valuestring,
+ access_token->valuestring);
token_lifetime->tv_sec = expires_in->valueint;
token_lifetime->tv_nsec = 0;
if (*token_elem != NULL) grpc_mdelem_unref(*token_elem);
@@ -539,9 +534,7 @@
response_cb(metadata_req, &response);
return;
}
- body = gpr_malloc(strlen(GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX) +
- strlen(jwt) + 1);
- sprintf(body, "%s%s", GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX, jwt);
+ gpr_asprintf(&body, "%s%s", GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX, jwt);
memset(&request, 0, sizeof(grpc_httpcli_request));
request.host = GRPC_SERVICE_ACCOUNT_HOST;
request.path = GRPC_SERVICE_ACCOUNT_TOKEN_PATH;
diff --git a/src/core/security/json_token.c b/src/core/security/json_token.c
index 14ee758..82bd9b5 100644
--- a/src/core/security/json_token.c
+++ b/src/core/security/json_token.c
@@ -37,9 +37,9 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include "src/core/security/base64.h"
+#include "src/core/support/string.h"
#include <openssl/bio.h>
#include <openssl/evp.h>
diff --git a/src/core/security/secure_endpoint.c b/src/core/security/secure_endpoint.c
index e73767c..9f12cf5 100644
--- a/src/core/security/secure_endpoint.c
+++ b/src/core/security/secure_endpoint.c
@@ -32,11 +32,11 @@
*/
#include "src/core/security/secure_endpoint.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
#include <grpc/support/slice.h>
-#include <grpc/support/string.h>
#include <grpc/support/sync.h>
#include "src/core/tsi/transport_security_interface.h"
diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c
index cce3c7f..58cd458 100644
--- a/src/core/security/security_context.c
+++ b/src/core/security/security_context.c
@@ -39,12 +39,12 @@
#include "src/core/channel/http_client_filter.h"
#include "src/core/security/credentials.h"
#include "src/core/security/secure_endpoint.h"
+#include "src/core/support/string.h"
#include "src/core/surface/lame_client.h"
#include "src/core/transport/chttp2/alpn.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
-#include <grpc/support/string.h>
#include "src/core/tsi/fake_transport_security.h"
#include "src/core/tsi/ssl_transport_security.h"
diff --git a/src/core/statistics/census_rpc_stats.c b/src/core/statistics/census_rpc_stats.c
index 39094b5..dd3c07e 100644
--- a/src/core/statistics/census_rpc_stats.c
+++ b/src/core/statistics/census_rpc_stats.c
@@ -39,9 +39,9 @@
#include "src/core/statistics/census_tracing.h"
#include "src/core/statistics/window_stats.h"
#include "src/core/support/murmur_hash.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/sync.h>
#define NUM_INTERVALS 3
diff --git a/src/core/statistics/census_tracing.c b/src/core/statistics/census_tracing.c
index 1e61602..3c4ba66 100644
--- a/src/core/statistics/census_tracing.c
+++ b/src/core/statistics/census_tracing.c
@@ -38,10 +38,10 @@
#include "src/core/statistics/census_rpc_stats.h"
#include "src/core/statistics/hash_table.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/string.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
diff --git a/src/core/support/cmdline.c b/src/core/support/cmdline.c
index ff163a1..a55da9d 100644
--- a/src/core/support/cmdline.c
+++ b/src/core/support/cmdline.c
@@ -37,9 +37,9 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
typedef enum { ARGTYPE_INT, ARGTYPE_BOOL, ARGTYPE_STRING } argtype;
diff --git a/src/core/support/host_port.c b/src/core/support/host_port.c
index 0250055..446c11e 100644
--- a/src/core/support/host_port.c
+++ b/src/core/support/host_port.c
@@ -35,8 +35,8 @@
#include <string.h>
+#include "src/core/support/string.h"
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
int gpr_join_host_port(char **out, const char *host, int port) {
if (host[0] != '[' && strchr(host, ':') != NULL) {
diff --git a/src/core/support/string.c b/src/core/support/string.c
index 7960547..9b5cac7 100644
--- a/src/core/support/string.c
+++ b/src/core/support/string.c
@@ -31,7 +31,7 @@
*
*/
-#include <grpc/support/string.h>
+#include "src/core/support/string.h"
#include <ctype.h>
#include <stddef.h>
@@ -122,3 +122,33 @@
*result = out;
return 1;
}
+
+void gpr_reverse_bytes(char *str, int len) {
+ char *p1, *p2;
+ for (p1 = str, p2 = str + len - 1; p2 > p1; ++p1, --p2) {
+ char temp = *p1;
+ *p1 = *p2;
+ *p2 = temp;
+ }
+}
+
+int gpr_ltoa(long value, char *string) {
+ int i = 0;
+ int neg = value < 0;
+
+ if (value == 0) {
+ string[0] = '0';
+ string[1] = 0;
+ return 1;
+ }
+
+ if (neg) value = -value;
+ while (value) {
+ string[i++] = '0' + value % 10;
+ value /= 10;
+ }
+ if (neg) string[i++] = '-';
+ gpr_reverse_bytes(string, i);
+ string[i] = 0;
+ return i;
+}
diff --git a/include/grpc/support/string.h b/src/core/support/string.h
similarity index 88%
rename from include/grpc/support/string.h
rename to src/core/support/string.h
index 68e7452..28b7029 100644
--- a/include/grpc/support/string.h
+++ b/src/core/support/string.h
@@ -60,6 +60,17 @@
int gpr_parse_bytes_to_uint32(const char *data, size_t length,
gpr_uint32 *result);
+/* Minimum buffer size for calling ltoa */
+#define GPR_LTOA_MIN_BUFSIZE (3 * sizeof(long))
+
+/* Convert a long to a string in base 10; returns the length of the
+ output string (or 0 on failure).
+ output must be at least GPR_LTOA_MIN_BUFSIZE bytes long. */
+int gpr_ltoa(long value, char *output);
+
+/* Reverse a run of bytes */
+void gpr_reverse_bytes(char *str, int len);
+
/* printf to a newly-allocated string. The set of supported formats may vary
between platforms.
diff --git a/src/core/surface/byte_buffer.c b/src/core/surface/byte_buffer.c
index 27a6c6e..d1be410 100644
--- a/src/core/surface/byte_buffer.c
+++ b/src/core/surface/byte_buffer.c
@@ -49,6 +49,17 @@
return bb;
}
+grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb) {
+ switch (bb->type) {
+ case GRPC_BB_SLICE_BUFFER:
+ return grpc_byte_buffer_create(bb->data.slice_buffer.slices,
+ bb->data.slice_buffer.count);
+ }
+ gpr_log(GPR_INFO, "should never get here");
+ abort();
+ return NULL;
+}
+
void grpc_byte_buffer_destroy(grpc_byte_buffer *bb) {
switch (bb->type) {
case GRPC_BB_SLICE_BUFFER:
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index 46502fb..14d990d 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -35,11 +35,11 @@
#include "src/core/channel/channel_stack.h"
#include "src/core/channel/metadata_buffer.h"
#include "src/core/iomgr/alarm.h"
+#include "src/core/support/string.h"
#include "src/core/surface/channel.h"
#include "src/core/surface/completion_queue.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -173,11 +173,14 @@
/* protects variables in this section */
gpr_mu read_mu;
+ gpr_uint8 received_start;
+ gpr_uint8 start_ok;
gpr_uint8 reads_done;
gpr_uint8 received_finish;
gpr_uint8 received_metadata;
gpr_uint8 have_read;
gpr_uint8 have_alarm;
+ gpr_uint8 pending_writes_done;
gpr_uint8 got_status_code;
/* The current outstanding read message tag (only valid if have_read == 1) */
void *read_tag;
@@ -190,6 +193,8 @@
/* The current outstanding send message/context/invoke/end tag (only valid if
have_write == 1) */
void *write_tag;
+ grpc_byte_buffer *pending_write;
+ gpr_uint32 pending_write_flags;
/* The final status of the call */
grpc_status_code status_code;
@@ -227,11 +232,15 @@
call->have_alarm = 0;
call->received_metadata = 0;
call->got_status_code = 0;
+ call->start_ok = 0;
call->status_code =
server_transport_data != NULL ? GRPC_STATUS_OK : GRPC_STATUS_UNKNOWN;
call->status_details = NULL;
call->received_finish = 0;
call->reads_done = 0;
+ call->received_start = 0;
+ call->pending_write = NULL;
+ call->pending_writes_done = 0;
grpc_metadata_buffer_init(&call->incoming_metadata);
gpr_ref_init(&call->internal_refcount, 1);
grpc_call_stack_init(channel_stack, server_transport_data,
@@ -360,16 +369,6 @@
return GRPC_CALL_OK;
}
-static void done_invoke(void *user_data, grpc_op_error error) {
- grpc_call *call = user_data;
- void *tag = call->write_tag;
-
- GPR_ASSERT(call->have_write);
- call->have_write = 0;
- call->write_tag = INVALID_TAG;
- grpc_cq_end_invoke_accepted(call->cq, tag, call, NULL, NULL, error);
-}
-
static void finish_call(grpc_call *call) {
size_t count;
grpc_metadata *elements;
@@ -384,11 +383,81 @@
elements, count);
}
-grpc_call_error grpc_call_start_invoke(grpc_call *call,
- grpc_completion_queue *cq,
- void *invoke_accepted_tag,
- void *metadata_read_tag,
- void *finished_tag, gpr_uint32 flags) {
+static void done_write(void *user_data, grpc_op_error error) {
+ grpc_call *call = user_data;
+ void *tag = call->write_tag;
+
+ GPR_ASSERT(call->have_write);
+ call->have_write = 0;
+ call->write_tag = INVALID_TAG;
+ grpc_cq_end_write_accepted(call->cq, tag, call, NULL, NULL, error);
+}
+
+static void done_writes_done(void *user_data, grpc_op_error error) {
+ grpc_call *call = user_data;
+ void *tag = call->write_tag;
+
+ GPR_ASSERT(call->have_write);
+ call->have_write = 0;
+ call->write_tag = INVALID_TAG;
+ grpc_cq_end_finish_accepted(call->cq, tag, call, NULL, NULL, error);
+}
+
+static void call_started(void *user_data, grpc_op_error error) {
+ grpc_call *call = user_data;
+ grpc_call_element *elem;
+ grpc_byte_buffer *pending_write = NULL;
+ gpr_uint32 pending_write_flags = 0;
+ gpr_uint8 pending_writes_done = 0;
+ int ok;
+ grpc_call_op op;
+
+ gpr_mu_lock(&call->read_mu);
+ GPR_ASSERT(!call->received_start);
+ call->received_start = 1;
+ ok = call->start_ok = (error == GRPC_OP_OK);
+ pending_write = call->pending_write;
+ pending_write_flags = call->pending_write_flags;
+ pending_writes_done = call->pending_writes_done;
+ gpr_mu_unlock(&call->read_mu);
+
+ if (pending_write) {
+ if (ok) {
+ op.type = GRPC_SEND_MESSAGE;
+ op.dir = GRPC_CALL_DOWN;
+ op.flags = pending_write_flags;
+ op.done_cb = done_write;
+ op.user_data = call;
+ op.data.message = pending_write;
+
+ elem = CALL_ELEM_FROM_CALL(call, 0);
+ elem->filter->call_op(elem, NULL, &op);
+ } else {
+ done_write(call, error);
+ }
+ grpc_byte_buffer_destroy(pending_write);
+ }
+ if (pending_writes_done) {
+ if (ok) {
+ op.type = GRPC_SEND_FINISH;
+ op.dir = GRPC_CALL_DOWN;
+ op.flags = 0;
+ op.done_cb = done_writes_done;
+ op.user_data = call;
+
+ elem = CALL_ELEM_FROM_CALL(call, 0);
+ elem->filter->call_op(elem, NULL, &op);
+ } else {
+ done_writes_done(call, error);
+ }
+ }
+
+ grpc_call_internal_unref(call);
+}
+
+grpc_call_error grpc_call_invoke(grpc_call *call, grpc_completion_queue *cq,
+ void *metadata_read_tag, void *finished_tag,
+ gpr_uint32 flags) {
grpc_call_element *elem;
grpc_call_op op;
@@ -420,7 +489,6 @@
/* inform the completion queue of an incoming operation */
grpc_cq_begin_op(cq, call, GRPC_FINISHED);
grpc_cq_begin_op(cq, call, GRPC_CLIENT_METADATA_READ);
- grpc_cq_begin_op(cq, call, GRPC_INVOKE_ACCEPTED);
gpr_mu_lock(&call->read_mu);
@@ -431,8 +499,6 @@
if (call->received_finish) {
/* handle early cancellation */
- grpc_cq_end_invoke_accepted(call->cq, invoke_accepted_tag, call, NULL, NULL,
- GRPC_OP_ERROR);
grpc_cq_end_client_metadata_read(call->cq, metadata_read_tag, call, NULL,
NULL, 0, NULL);
finish_call(call);
@@ -442,20 +508,18 @@
return GRPC_CALL_OK;
}
- call->write_tag = invoke_accepted_tag;
call->metadata_tag = metadata_read_tag;
- call->have_write = 1;
-
gpr_mu_unlock(&call->read_mu);
/* call down the filter stack */
op.type = GRPC_SEND_START;
op.dir = GRPC_CALL_DOWN;
op.flags = flags;
- op.done_cb = done_invoke;
+ op.done_cb = call_started;
op.data.start.pollset = grpc_cq_pollset(cq);
op.user_data = call;
+ grpc_call_internal_ref(call);
elem = CALL_ELEM_FROM_CALL(call, 0);
elem->filter->call_op(elem, NULL, &op);
@@ -486,6 +550,7 @@
call->state = CALL_BOUNDCQ;
call->cq = cq;
call->finished_tag = finished_tag;
+ call->received_start = 1;
if (prq_is_empty(&call->prq) && call->received_finish) {
finish_call(call);
@@ -535,26 +600,6 @@
return GRPC_CALL_OK;
}
-static void done_writes_done(void *user_data, grpc_op_error error) {
- grpc_call *call = user_data;
- void *tag = call->write_tag;
-
- GPR_ASSERT(call->have_write);
- call->have_write = 0;
- call->write_tag = INVALID_TAG;
- grpc_cq_end_finish_accepted(call->cq, tag, call, NULL, NULL, error);
-}
-
-static void done_write(void *user_data, grpc_op_error error) {
- grpc_call *call = user_data;
- void *tag = call->write_tag;
-
- GPR_ASSERT(call->have_write);
- call->have_write = 0;
- call->write_tag = INVALID_TAG;
- grpc_cq_end_write_accepted(call->cq, tag, call, NULL, NULL, error);
-}
-
void grpc_call_client_initial_metadata_complete(
grpc_call_element *surface_element) {
grpc_call *call = grpc_call_from_top_element(surface_element);
@@ -617,7 +662,7 @@
} else {
call->read_tag = tag;
call->have_read = 1;
- request_more = 1;
+ request_more = call->received_start;
}
} else if (prq_is_empty(&call->prq) && call->received_finish) {
finish_call(call);
@@ -654,8 +699,6 @@
grpc_cq_begin_op(call->cq, call, GRPC_WRITE_ACCEPTED);
- /* for now we do no buffering, so a NULL byte_buffer can have no impact
- on our behavior -- succeed immediately */
/* TODO(ctiller): if flags & GRPC_WRITE_BUFFER_HINT == 0, this indicates a
flush, and that flush should be propogated down from here */
if (byte_buffer == NULL) {
@@ -666,15 +709,25 @@
call->write_tag = tag;
call->have_write = 1;
- op.type = GRPC_SEND_MESSAGE;
- op.dir = GRPC_CALL_DOWN;
- op.flags = flags;
- op.done_cb = done_write;
- op.user_data = call;
- op.data.message = byte_buffer;
+ gpr_mu_lock(&call->read_mu);
+ if (!call->received_start) {
+ call->pending_write = grpc_byte_buffer_copy(byte_buffer);
+ call->pending_write_flags = flags;
- elem = CALL_ELEM_FROM_CALL(call, 0);
- elem->filter->call_op(elem, NULL, &op);
+ gpr_mu_unlock(&call->read_mu);
+ } else {
+ gpr_mu_unlock(&call->read_mu);
+
+ op.type = GRPC_SEND_MESSAGE;
+ op.dir = GRPC_CALL_DOWN;
+ op.flags = flags;
+ op.done_cb = done_write;
+ op.user_data = call;
+ op.data.message = byte_buffer;
+
+ elem = CALL_ELEM_FROM_CALL(call, 0);
+ elem->filter->call_op(elem, NULL, &op);
+ }
return GRPC_CALL_OK;
}
@@ -706,14 +759,23 @@
call->write_tag = tag;
call->have_write = 1;
- op.type = GRPC_SEND_FINISH;
- op.dir = GRPC_CALL_DOWN;
- op.flags = 0;
- op.done_cb = done_writes_done;
- op.user_data = call;
+ gpr_mu_lock(&call->read_mu);
+ if (!call->received_start) {
+ call->pending_writes_done = 1;
- elem = CALL_ELEM_FROM_CALL(call, 0);
- elem->filter->call_op(elem, NULL, &op);
+ gpr_mu_unlock(&call->read_mu);
+ } else {
+ gpr_mu_unlock(&call->read_mu);
+
+ op.type = GRPC_SEND_FINISH;
+ op.dir = GRPC_CALL_DOWN;
+ op.flags = 0;
+ op.done_cb = done_writes_done;
+ op.user_data = call;
+
+ elem = CALL_ELEM_FROM_CALL(call, 0);
+ elem->filter->call_op(elem, NULL, &op);
+ }
return GRPC_CALL_OK;
}
@@ -760,8 +822,8 @@
/* always send status */
{
grpc_mdelem *md;
- char buffer[32];
- sprintf(buffer, "%d", status);
+ char buffer[GPR_LTOA_MIN_BUFSIZE];
+ gpr_ltoa(status, buffer);
md =
grpc_mdelem_from_strings(call->metadata_context, "grpc-status", buffer);
@@ -818,6 +880,8 @@
grpc_call *call = CALL_FROM_TOP_ELEM(elem);
grpc_mdelem *md = op->data.metadata;
grpc_mdstr *key = md->key;
+ gpr_log(GPR_DEBUG, "call %p got metadata %s %s", call,
+ grpc_mdstr_as_c_string(md->key), grpc_mdstr_as_c_string(md->value));
if (key == grpc_channel_get_status_string(call->channel)) {
maybe_set_status_code(call, decode_status(md));
grpc_mdelem_unref(md);
diff --git a/src/core/surface/channel_create.c b/src/core/surface/channel_create.c
index 41093d7..6939b92 100644
--- a/src/core/surface/channel_create.c
+++ b/src/core/surface/channel_create.c
@@ -48,10 +48,10 @@
#include "src/core/iomgr/tcp_client.h"
#include "src/core/surface/channel.h"
#include "src/core/surface/client.h"
+#include "src/core/support/string.h"
#include "src/core/transport/chttp2_transport.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
diff --git a/src/core/surface/client.c b/src/core/surface/client.c
index 74c79bd..fe3a81f 100644
--- a/src/core/surface/client.c
+++ b/src/core/surface/client.c
@@ -34,9 +34,9 @@
#include "src/core/surface/client.h"
#include "src/core/surface/call.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
typedef struct { void *unused; } call_data;
diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c
index 652f23e..2bf31c5 100644
--- a/src/core/surface/completion_queue.c
+++ b/src/core/surface/completion_queue.c
@@ -37,13 +37,13 @@
#include <string.h>
#include "src/core/iomgr/pollset.h"
+#include "src/core/support/string.h"
#include "src/core/surface/call.h"
#include "src/core/surface/event_string.h"
#include "src/core/surface/surface_trace.h"
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#define NUM_TAG_BUCKETS 31
@@ -396,12 +396,13 @@
void grpc_cq_dump_pending_ops(grpc_completion_queue *cc) {
#ifndef NDEBUG
- char tmp[256];
+ char tmp[GRPC_COMPLETION_DO_NOT_USE * (1 + GPR_LTOA_MIN_BUFSIZE)];
char *p = tmp;
int i;
for (i = 0; i < GRPC_COMPLETION_DO_NOT_USE; i++) {
- p += sprintf(p, " %d", (int)cc->pending_op_count[i]);
+ *p++ = ' ';
+ p += gpr_ltoa(cc->pending_op_count[i], p);
}
gpr_log(GPR_INFO, "pending ops:%s", tmp);
diff --git a/src/core/surface/event_string.c b/src/core/surface/event_string.c
index 8ae2af7..e38ef06 100644
--- a/src/core/surface/event_string.c
+++ b/src/core/surface/event_string.c
@@ -35,7 +35,7 @@
#include <stdio.h>
-#include <grpc/support/string.h>
+#include "src/core/support/string.h"
#include <grpc/byte_buffer.h>
static size_t addhdr(char *p, grpc_event *ev) {
diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c
index a5244db..056c986 100644
--- a/src/core/surface/lame_client.c
+++ b/src/core/surface/lame_client.c
@@ -36,11 +36,11 @@
#include <string.h>
#include "src/core/channel/channel_stack.h"
+#include "src/core/support/string.h"
#include "src/core/surface/channel.h"
#include "src/core/surface/call.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
typedef struct { void *unused; } call_data;
diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c
index 3d57279..a231b27 100644
--- a/src/core/surface/secure_channel_create.c
+++ b/src/core/surface/secure_channel_create.c
@@ -48,13 +48,13 @@
#include "src/core/security/auth.h"
#include "src/core/security/security_context.h"
#include "src/core/security/secure_transport_setup.h"
+#include "src/core/support/string.h"
#include "src/core/surface/channel.h"
#include "src/core/surface/client.h"
#include "src/core/transport/chttp2_transport.h"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
#include "src/core/tsi/transport_security_interface.h"
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index cbdd3bf..9585e4e 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -40,12 +40,12 @@
#include "src/core/channel/channel_args.h"
#include "src/core/channel/connected_channel.h"
#include "src/core/iomgr/iomgr.h"
+#include "src/core/support/string.h"
#include "src/core/surface/call.h"
#include "src/core/surface/channel.h"
#include "src/core/surface/completion_queue.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/useful.h>
typedef enum { PENDING_START, ALL_CALLS, CALL_LIST_COUNT } call_list;
diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c
index c22a223..dee61ce 100644
--- a/src/core/transport/chttp2/frame_data.c
+++ b/src/core/transport/chttp2/frame_data.c
@@ -35,9 +35,9 @@
#include <string.h>
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/useful.h>
#include "src/core/transport/transport.h"
@@ -141,7 +141,7 @@
gpr_slice_sub(slice, cur - beg, end - beg));
p->state = GRPC_CHTTP2_DATA_FH_0;
return GRPC_CHTTP2_PARSE_OK;
- } else if (end - cur > p->frame_size) {
+ } else if ((gpr_uint32)(end - cur) > p->frame_size) {
state->need_flush_reads = 1;
grpc_sopb_add_slice(
&p->incoming_sopb,
diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c
index 07b0f81..c98b90e 100644
--- a/src/core/transport/chttp2/hpack_parser.c
+++ b/src/core/transport/chttp2/hpack_parser.c
@@ -38,10 +38,10 @@
#include <assert.h>
#include "src/core/transport/chttp2/bin_encoder.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/string.h>
#include <grpc/support/useful.h>
typedef enum {
@@ -1212,7 +1212,7 @@
gpr_int16 next = next_sub_tbl[16 * next_tbl[p->huff_state] + nibble];
if (emit != -1) {
if (emit >= 0 && emit < 256) {
- gpr_uint8 c = emit;
+ gpr_uint8 c = (gpr_uint8) emit;
if (!append_string(p, &c, (&c) + 1)) return 0;
} else {
assert(emit == 256);
diff --git a/src/core/transport/chttp2/timeout_encoding.c b/src/core/transport/chttp2/timeout_encoding.c
index 2706c36..23c4554 100644
--- a/src/core/transport/chttp2/timeout_encoding.c
+++ b/src/core/transport/chttp2/timeout_encoding.c
@@ -36,6 +36,8 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/support/string.h"
+
static int round_up(int x, int divisor) {
return (x / divisor + (x % divisor != 0)) * divisor;
}
@@ -53,15 +55,21 @@
}
/* encode our minimum viable timeout value */
-static void enc_tiny(char *buffer) { strcpy(buffer, "1n"); }
+static void enc_tiny(char *buffer) { memcpy(buffer, "1n", 3); }
+
+static void enc_ext(char *buffer, long value, char ext) {
+ int n = gpr_ltoa(value, buffer);
+ buffer[n] = ext;
+ buffer[n+1] = 0;
+}
static void enc_seconds(char *buffer, long sec) {
if (sec % 3600 == 0) {
- sprintf(buffer, "%ldH", sec / 3600);
+ enc_ext(buffer, sec / 3600, 'H');
} else if (sec % 60 == 0) {
- sprintf(buffer, "%ldM", sec / 60);
+ enc_ext(buffer, sec / 60, 'M');
} else {
- sprintf(buffer, "%ldS", sec);
+ enc_ext(buffer, sec, 'S');
}
}
@@ -69,23 +77,23 @@
x = round_up_to_three_sig_figs(x);
if (x < 100000) {
if (x % 1000 == 0) {
- sprintf(buffer, "%du", x / 1000);
+ enc_ext(buffer, x / 1000, 'u');
} else {
- sprintf(buffer, "%dn", x);
+ enc_ext(buffer, x, 'n');
}
} else if (x < 100000000) {
if (x % 1000000 == 0) {
- sprintf(buffer, "%dm", x / 1000000);
+ enc_ext(buffer, x / 1000000, 'm');
} else {
- sprintf(buffer, "%du", x / 1000);
+ enc_ext(buffer, x / 1000, 'u');
}
} else if (x < 1000000000) {
- sprintf(buffer, "%dm", x / 1000000);
+ enc_ext(buffer, x / 1000000, 'm');
} else {
/* note that this is only ever called with times of less than one second,
so if we reach here the time must have been rounded up to a whole second
(and no more) */
- strcpy(buffer, "1S");
+ memcpy(buffer, "1S", 3);
}
}
@@ -93,18 +101,18 @@
x = round_up_to_three_sig_figs(x);
if (x < 100000) {
if (x % 1000 == 0) {
- sprintf(buffer, "%dm", x / 1000);
+ enc_ext(buffer, x / 1000, 'm');
} else {
- sprintf(buffer, "%du", x);
+ enc_ext(buffer, x, 'u');
}
} else if (x < 100000000) {
if (x % 1000000 == 0) {
- sprintf(buffer, "%dS", x / 1000000);
+ enc_ext(buffer, x / 1000000, 'S');
} else {
- sprintf(buffer, "%dm", x / 1000);
+ enc_ext(buffer, x / 1000, 'm');
}
} else {
- sprintf(buffer, "%dS", x / 1000000);
+ enc_ext(buffer, x / 1000000, 'S');
}
}
diff --git a/src/core/transport/chttp2/timeout_encoding.h b/src/core/transport/chttp2/timeout_encoding.h
index a458256..d1e4776 100644
--- a/src/core/transport/chttp2/timeout_encoding.h
+++ b/src/core/transport/chttp2/timeout_encoding.h
@@ -34,8 +34,11 @@
#ifndef __GRPC_INTERNAL_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H_
#define __GRPC_INTERNAL_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H_
+#include "src/core/support/string.h"
#include <grpc/support/time.h>
+#define GRPC_CHTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE (GPR_LTOA_MIN_BUFSIZE + 1)
+
/* Encode/decode timeouts to the GRPC over HTTP2 format;
encoding may round up arbitrarily */
void grpc_chttp2_encode_timeout(gpr_timespec timeout, char *buffer);
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index e61afb7..531a53b 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/support/string.h"
#include "src/core/transport/chttp2/frame_data.h"
#include "src/core/transport/chttp2/frame_goaway.h"
#include "src/core/transport/chttp2/frame_ping.h"
@@ -53,7 +54,6 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
-#include <grpc/support/string.h>
#include <grpc/support/useful.h>
#define DEFAULT_WINDOW 65535
@@ -1002,7 +1002,7 @@
grpc_chttp2_error_code error_code,
int send_rst) {
int had_outgoing;
- char buffer[32];
+ char buffer[GPR_LTOA_MIN_BUFSIZE];
if (s) {
/* clear out any unreported input & output: nobody cares anymore */
@@ -1015,7 +1015,7 @@
s->cancelled = 1;
stream_list_join(t, s, CANCELLED);
- sprintf(buffer, "%d", local_status);
+ gpr_ltoa(local_status, buffer);
grpc_sopb_add_metadata(
&s->parser.incoming_sopb,
grpc_mdelem_from_strings(t->metadata_context, "grpc-status", buffer));
@@ -1611,7 +1611,7 @@
}
t->deframe_state = DTS_FH_0;
return 1;
- } else if (end - cur > t->incoming_frame_size) {
+ } else if ((gpr_uint32)(end - cur) > t->incoming_frame_size) {
if (!parse_frame_slice(
t, gpr_slice_sub_no_ref(slice, cur - beg,
cur + t->incoming_frame_size - beg),
diff --git a/src/core/transport/stream_op.c b/src/core/transport/stream_op.c
index c77c8cd..555543f 100644
--- a/src/core/transport/stream_op.c
+++ b/src/core/transport/stream_op.c
@@ -63,7 +63,7 @@
}
void grpc_stream_ops_unref_owned_objects(grpc_stream_op *ops, size_t nops) {
- int i;
+ size_t i;
for (i = 0; i < nops; i++) {
switch (ops[i].type) {
case GRPC_OP_SLICE:
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index a8919a1..c8b2bb2 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -104,7 +104,6 @@
context->set_call(call);
grpc_event *ev;
void *finished_tag = reinterpret_cast<char *>(call);
- void *invoke_tag = reinterpret_cast<char *>(call) + 1;
void *metadata_read_tag = reinterpret_cast<char *>(call) + 2;
void *write_tag = reinterpret_cast<char *>(call) + 3;
void *halfclose_tag = reinterpret_cast<char *>(call) + 4;
@@ -115,19 +114,11 @@
// add_metadata from context
//
// invoke
- GPR_ASSERT(grpc_call_start_invoke(call, cq, invoke_tag, metadata_read_tag,
- finished_tag,
- GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK);
- ev = grpc_completion_queue_pluck(cq, invoke_tag, gpr_inf_future);
- bool success = ev->data.invoke_accepted == GRPC_OP_OK;
- grpc_event_finish(ev);
- if (!success) {
- GetFinalStatus(cq, finished_tag, &status);
- return status;
- }
+ GPR_ASSERT(grpc_call_invoke(call, cq, metadata_read_tag, finished_tag,
+ GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK);
// write request
grpc_byte_buffer *write_buffer = nullptr;
- success = SerializeProto(request, &write_buffer);
+ bool success = SerializeProto(request, &write_buffer);
if (!success) {
grpc_call_cancel(call);
status =
diff --git a/src/cpp/stream/stream_context.cc b/src/cpp/stream/stream_context.cc
index e64010b..edb2fc5 100644
--- a/src/cpp/stream/stream_context.cc
+++ b/src/cpp/stream/stream_context.cc
@@ -80,17 +80,9 @@
if (is_client_) {
// TODO(yangg) handle metadata send path
int flag = buffered ? GRPC_WRITE_BUFFER_HINT : 0;
- grpc_call_error error = grpc_call_start_invoke(call(), cq(), invoke_tag(),
- client_metadata_read_tag(),
- finished_tag(), flag);
+ grpc_call_error error = grpc_call_invoke(
+ call(), cq(), client_metadata_read_tag(), finished_tag(), flag);
GPR_ASSERT(GRPC_CALL_OK == error);
- grpc_event *invoke_ev =
- grpc_completion_queue_pluck(cq(), invoke_tag(), gpr_inf_future);
- if (invoke_ev->data.invoke_accepted != GRPC_OP_OK) {
- peer_halfclosed_ = true;
- self_halfclosed_ = true;
- }
- grpc_event_finish(invoke_ev);
} else {
// TODO(yangg) metadata needs to be added before accept
// TODO(yangg) correctly set flag to accept
diff --git a/src/cpp/stream/stream_context.h b/src/cpp/stream/stream_context.h
index 8697d86..8def589 100644
--- a/src/cpp/stream/stream_context.h
+++ b/src/cpp/stream/stream_context.h
@@ -76,7 +76,6 @@
void *read_tag() { return reinterpret_cast<char *>(this) + 1; }
void *write_tag() { return reinterpret_cast<char *>(this) + 2; }
void *halfclose_tag() { return reinterpret_cast<char *>(this) + 3; }
- void *invoke_tag() { return reinterpret_cast<char *>(this) + 4; }
void *client_metadata_read_tag() {
return reinterpret_cast<char *>(this) + 5;
}
diff --git a/src/node/binding.gyp b/src/node/binding.gyp
index da4a943..fe4b5da 100644
--- a/src/node/binding.gyp
+++ b/src/node/binding.gyp
@@ -1,8 +1,13 @@
{
+ "variables" : {
+ 'no_install': "<!(echo $GRPC_NO_INSTALL)",
+ 'grpc_root': "<!(echo $GRPC_ROOT)",
+ 'grpc_lib_subdir': "<!(echo $GRPC_LIB_SUBDIR)"
+ },
"targets" : [
{
'include_dirs': [
- "<!(node -e \"require('nan')\")"
+ "<!(nodejs -e \"require('nan')\")"
],
'cxxflags': [
'-Wall',
@@ -11,16 +16,13 @@
'-g',
'-zdefs'
'-Werror',
- ],
+ ],
'ldflags': [
- '-g',
- '-L/usr/local/google/home/mlumish/grpc_dev/lib'
+ '-g'
],
'link_settings': {
'libraries': [
- '-lgrpc',
'-lrt',
- '-lgpr',
'-lpthread'
],
},
@@ -37,6 +39,27 @@
"server_credentials.cc",
"tag.cc",
"timeval.cc"
+ ],
+ 'conditions' : [
+ ['no_install=="yes"', {
+ 'include_dirs': [
+ "<(grpc_root)/include"
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '<(grpc_root)/<(grpc_lib_subdir)/libgrpc.a',
+ '<(grpc_root)/<(grpc_lib_subdir)/libgpr.a'
+ ]
+ }
+ }],
+ ['no_install!="yes"', {
+ 'link_settings': {
+ 'libraries': [
+ '-lgrpc',
+ '-lgpr'
+ ]
+ }
+ }]
]
}
]
diff --git a/src/node/call.cc b/src/node/call.cc
index b8ee178..6434c2f 100644
--- a/src/node/call.cc
+++ b/src/node/call.cc
@@ -78,8 +78,8 @@
tpl->InstanceTemplate()->SetInternalFieldCount(1);
NanSetPrototypeTemplate(tpl, "addMetadata",
FunctionTemplate::New(AddMetadata)->GetFunction());
- NanSetPrototypeTemplate(tpl, "startInvoke",
- FunctionTemplate::New(StartInvoke)->GetFunction());
+ NanSetPrototypeTemplate(tpl, "invoke",
+ FunctionTemplate::New(Invoke)->GetFunction());
NanSetPrototypeTemplate(tpl, "serverAccept",
FunctionTemplate::New(ServerAccept)->GetFunction());
NanSetPrototypeTemplate(
@@ -203,37 +203,30 @@
NanReturnUndefined();
}
-NAN_METHOD(Call::StartInvoke) {
+NAN_METHOD(Call::Invoke) {
NanScope();
if (!HasInstance(args.This())) {
- return NanThrowTypeError("startInvoke can only be called on Call objects");
+ return NanThrowTypeError("invoke can only be called on Call objects");
}
if (!args[0]->IsFunction()) {
- return NanThrowTypeError("StartInvoke's first argument must be a function");
+ return NanThrowTypeError("invoke's first argument must be a function");
}
if (!args[1]->IsFunction()) {
- return NanThrowTypeError(
- "StartInvoke's second argument must be a function");
+ return NanThrowTypeError("invoke's second argument must be a function");
}
- if (!args[2]->IsFunction()) {
- return NanThrowTypeError("StartInvoke's third argument must be a function");
- }
- if (!args[3]->IsUint32()) {
- return NanThrowTypeError(
- "StartInvoke's fourth argument must be integer flags");
+ if (!args[2]->IsUint32()) {
+ return NanThrowTypeError("invoke's third argument must be integer flags");
}
Call *call = ObjectWrap::Unwrap<Call>(args.This());
unsigned int flags = args[3]->Uint32Value();
- grpc_call_error error = grpc_call_start_invoke(
+ grpc_call_error error = grpc_call_invoke(
call->wrapped_call, CompletionQueueAsyncWorker::GetQueue(),
- CreateTag(args[0], args.This()), CreateTag(args[1], args.This()),
- CreateTag(args[2], args.This()), flags);
+ CreateTag(args[0], args.This()), CreateTag(args[1], args.This()), flags);
if (error == GRPC_CALL_OK) {
CompletionQueueAsyncWorker::Next();
CompletionQueueAsyncWorker::Next();
- CompletionQueueAsyncWorker::Next();
} else {
- return NanThrowError("startInvoke failed", error);
+ return NanThrowError("invoke failed", error);
}
NanReturnUndefined();
}
@@ -281,7 +274,7 @@
NAN_METHOD(Call::Cancel) {
NanScope();
if (!HasInstance(args.This())) {
- return NanThrowTypeError("startInvoke can only be called on Call objects");
+ return NanThrowTypeError("cancel can only be called on Call objects");
}
Call *call = ObjectWrap::Unwrap<Call>(args.This());
grpc_call_error error = grpc_call_cancel(call->wrapped_call);
diff --git a/src/node/call.h b/src/node/call.h
index 55a6fc6..1924a1b 100644
--- a/src/node/call.h
+++ b/src/node/call.h
@@ -61,7 +61,7 @@
static NAN_METHOD(New);
static NAN_METHOD(AddMetadata);
- static NAN_METHOD(StartInvoke);
+ static NAN_METHOD(Invoke);
static NAN_METHOD(ServerAccept);
static NAN_METHOD(ServerEndInitialMetadata);
static NAN_METHOD(Cancel);
diff --git a/src/node/client.js b/src/node/client.js
index f913b06..2fefd14 100644
--- a/src/node/client.js
+++ b/src/node/client.js
@@ -62,12 +62,9 @@
};
}
var self = this;
- // Indicates that we can start reading and have not received a null read
- var can_read = false;
+ var finished = false;
// Indicates that a read is currently pending
var reading = false;
- // Indicates that we can call startWrite
- var can_write = false;
// Indicates that a write is currently pending
var writing = false;
this._call = call;
@@ -98,91 +95,46 @@
return deserialize(buffer);
};
/**
- * Callback to handle receiving a READ event. Pushes the data from that event
- * onto the read queue and starts reading again if applicable.
- * @param {grpc.Event} event The READ event object
+ * Callback to be called when a READ event is received. Pushes the data onto
+ * the read queue and starts reading again if applicable
+ * @param {grpc.Event} event READ event object
*/
function readCallback(event) {
+ if (finished) {
+ self.push(null);
+ return;
+ }
var data = event.data;
- if (self.push(self.deserialize(data))) {
- if (data == null) {
- // Disable starting to read after null read was received
- can_read = false;
- reading = false;
- } else {
- call.startRead(readCallback);
- }
+ if (self.push(data) && data != null) {
+ self._call.startRead(readCallback);
} else {
- // Indicate that reading can be resumed by calling startReading
reading = false;
}
- };
- /**
- * Initiate a read, which continues until self.push returns false (indicating
- * that reading should be paused) or data is null (indicating that there is no
- * more data to read).
- */
- function startReading() {
- call.startRead(readCallback);
}
- // TODO(mlumish): possibly change queue implementation due to shift slowness
- var write_queue = [];
- /**
- * Write the next chunk of data in the write queue if there is one. Otherwise
- * indicate that there is no pending write. When the write succeeds, this
- * function is called again.
- */
- function writeNext() {
- if (write_queue.length > 0) {
- writing = true;
- var next = write_queue.shift();
- var writeCallback = function(event) {
- next.callback();
- writeNext();
- };
- call.startWrite(self.serialize(next.chunk), writeCallback, 0);
- } else {
- writing = false;
- }
- }
- call.startInvoke(function(event) {
- can_read = true;
- can_write = true;
- startReading();
- writeNext();
- }, function(event) {
+ call.invoke(function(event) {
self.emit('metadata', event.data);
}, function(event) {
+ finished = true;
self.emit('status', event.data);
}, 0);
this.on('finish', function() {
call.writesDone(function() {});
});
/**
- * Indicate that reads should start, and start them if the INVOKE_ACCEPTED
- * event has been received.
+ * Start reading if there is not already a pending read. Reading will
+ * continue until self.push returns false (indicating reads should slow
+ * down) or the read data is null (indicating that there is no more data).
*/
- this._enableRead = function() {
- if (!reading) {
- reading = true;
- if (can_read) {
- startReading();
+ this.startReading = function() {
+ if (finished) {
+ self.push(null);
+ } else {
+ if (!reading) {
+ reading = true;
+ self._call.startRead(readCallback);
}
}
};
- /**
- * Push the chunk onto the write queue, and write from the write queue if
- * there is not a pending write
- * @param {Buffer} chunk The chunk of data to write
- * @param {function(Error=)} callback The callback to call when the write
- * completes
- */
- this._tryWrite = function(chunk, callback) {
- write_queue.push({chunk: chunk, callback: callback});
- if (can_write && !writing) {
- writeNext();
- }
- };
}
/**
@@ -191,7 +143,7 @@
* @param {number} size Ignored
*/
GrpcClientStream.prototype._read = function(size) {
- this._enableRead();
+ this.startReading();
};
/**
@@ -202,7 +154,10 @@
* @param {function(Error=)} callback Ignored
*/
GrpcClientStream.prototype._write = function(chunk, encoding, callback) {
- this._tryWrite(chunk, callback);
+ var self = this;
+ self._call.startWrite(chunk, function(event) {
+ callback();
+ }, 0);
};
/**
diff --git a/src/node/interop/interop_server.js b/src/node/interop/interop_server.js
index 6d2bd7a..ebf8478 100644
--- a/src/node/interop/interop_server.js
+++ b/src/node/interop/interop_server.js
@@ -194,7 +194,8 @@
string: ['port', 'use_tls']
});
var server_obj = getServer(argv.port, argv.use_tls === 'true');
- server_obj.server.start();
+ console.log('Server attaching to port ' + argv.port);
+ server_obj.server.listen();
}
/**
diff --git a/src/node/node_grpc.cc b/src/node/node_grpc.cc
index acee038..bc1dfaf 100644
--- a/src/node/node_grpc.cc
+++ b/src/node/node_grpc.cc
@@ -148,8 +148,6 @@
completion_type->Set(NanNew("QUEUE_SHUTDOWN"), QUEUE_SHUTDOWN);
Handle<Value> READ(NanNew<Uint32, uint32_t>(GRPC_READ));
completion_type->Set(NanNew("READ"), READ);
- Handle<Value> INVOKE_ACCEPTED(NanNew<Uint32, uint32_t>(GRPC_INVOKE_ACCEPTED));
- completion_type->Set(NanNew("INVOKE_ACCEPTED"), INVOKE_ACCEPTED);
Handle<Value> WRITE_ACCEPTED(NanNew<Uint32, uint32_t>(GRPC_WRITE_ACCEPTED));
completion_type->Set(NanNew("WRITE_ACCEPTED"), WRITE_ACCEPTED);
Handle<Value> FINISH_ACCEPTED(NanNew<Uint32, uint32_t>(GRPC_FINISH_ACCEPTED));
diff --git a/src/node/test/call_test.js b/src/node/test/call_test.js
index e6dc966..6e52ec8 100644
--- a/src/node/test/call_test.js
+++ b/src/node/test/call_test.js
@@ -118,12 +118,11 @@
call.addMetadata(5);
}, TypeError);
});
- it('should fail if startInvoke was already called', function(done) {
+ it('should fail if invoke was already called', function(done) {
var call = new grpc.Call(channel, 'method', getDeadline(1));
- call.startInvoke(function() {},
- function() {},
- function() {done();},
- 0);
+ call.invoke(function() {},
+ function() {done();},
+ 0);
assert.throws(function() {
call.addMetadata({'key' : 'key', 'value' : new Buffer('value') });
}, function(err) {
@@ -133,32 +132,26 @@
call.cancel();
});
});
- describe('startInvoke', function() {
- it('should fail with fewer than 4 arguments', function() {
+ describe('invoke', function() {
+ it('should fail with fewer than 3 arguments', function() {
var call = new grpc.Call(channel, 'method', getDeadline(1));
assert.throws(function() {
- call.startInvoke();
+ call.invoke();
}, TypeError);
assert.throws(function() {
- call.startInvoke(function() {});
+ call.invoke(function() {});
}, TypeError);
assert.throws(function() {
- call.startInvoke(function() {},
- function() {});
- }, TypeError);
- assert.throws(function() {
- call.startInvoke(function() {},
- function() {},
- function() {});
+ call.invoke(function() {},
+ function() {});
}, TypeError);
});
- it('should work with 3 args and an int', function(done) {
+ it('should work with 2 args and an int', function(done) {
assert.doesNotThrow(function() {
var call = new grpc.Call(channel, 'method', getDeadline(1));
- call.startInvoke(function() {},
- function() {},
- function() {done();},
- 0);
+ call.invoke(function() {},
+ function() {done();},
+ 0);
// Cancel to speed up the test
call.cancel();
});
@@ -166,12 +159,11 @@
it('should reject incorrectly typed arguments', function() {
var call = new grpc.Call(channel, 'method', getDeadline(1));
assert.throws(function() {
- call.startInvoke(0, 0, 0, 0);
+ call.invoke(0, 0, 0);
}, TypeError);
assert.throws(function() {
- call.startInvoke(function() {},
- function() {},
- function() {}, 'test');
+ call.invoke(function() {},
+ function() {}, 'test');
});
});
});
diff --git a/src/node/test/constant_test.js b/src/node/test/constant_test.js
index f65eea3..0138a55 100644
--- a/src/node/test/constant_test.js
+++ b/src/node/test/constant_test.js
@@ -94,7 +94,6 @@
var completionTypeNames = [
'QUEUE_SHUTDOWN',
'READ',
- 'INVOKE_ACCEPTED',
'WRITE_ACCEPTED',
'FINISH_ACCEPTED',
'CLIENT_METADATA_READ',
diff --git a/src/node/test/end_to_end_test.js b/src/node/test/end_to_end_test.js
index db3834d..f7ccbcf 100644
--- a/src/node/test/end_to_end_test.js
+++ b/src/node/test/end_to_end_test.js
@@ -70,16 +70,7 @@
var call = new grpc.Call(channel,
'dummy_method',
deadline);
- call.startInvoke(function(event) {
- assert.strictEqual(event.type,
- grpc.completionType.INVOKE_ACCEPTED);
-
- call.writesDone(function(event) {
- assert.strictEqual(event.type,
- grpc.completionType.FINISH_ACCEPTED);
- assert.strictEqual(event.data, grpc.opError.OK);
- });
- },function(event) {
+ call.invoke(function(event) {
assert.strictEqual(event.type,
grpc.completionType.CLIENT_METADATA_READ);
},function(event) {
@@ -109,8 +100,12 @@
done();
});
});
+ call.writesDone(function(event) {
+ assert.strictEqual(event.type,
+ grpc.completionType.FINISH_ACCEPTED);
+ assert.strictEqual(event.data, grpc.opError.OK);
+ });
});
-
it('should send and receive data without error', function(complete) {
var req_text = 'client_request';
var reply_text = 'server_response';
@@ -127,28 +122,7 @@
var call = new grpc.Call(channel,
'dummy_method',
deadline);
- call.startInvoke(function(event) {
- assert.strictEqual(event.type,
- grpc.completionType.INVOKE_ACCEPTED);
- call.startWrite(
- new Buffer(req_text),
- function(event) {
- assert.strictEqual(event.type,
- grpc.completionType.WRITE_ACCEPTED);
- assert.strictEqual(event.data, grpc.opError.OK);
- call.writesDone(function(event) {
- assert.strictEqual(event.type,
- grpc.completionType.FINISH_ACCEPTED);
- assert.strictEqual(event.data, grpc.opError.OK);
- done();
- });
- }, 0);
- call.startRead(function(event) {
- assert.strictEqual(event.type, grpc.completionType.READ);
- assert.strictEqual(event.data.toString(), reply_text);
- done();
- });
- },function(event) {
+ call.invoke(function(event) {
assert.strictEqual(event.type,
grpc.completionType.CLIENT_METADATA_READ);
done();
@@ -159,6 +133,24 @@
assert.strictEqual(status.details, status_text);
done();
}, 0);
+ call.startWrite(
+ new Buffer(req_text),
+ function(event) {
+ assert.strictEqual(event.type,
+ grpc.completionType.WRITE_ACCEPTED);
+ assert.strictEqual(event.data, grpc.opError.OK);
+ call.writesDone(function(event) {
+ assert.strictEqual(event.type,
+ grpc.completionType.FINISH_ACCEPTED);
+ assert.strictEqual(event.data, grpc.opError.OK);
+ done();
+ });
+ }, 0);
+ call.startRead(function(event) {
+ assert.strictEqual(event.type, grpc.completionType.READ);
+ assert.strictEqual(event.data.toString(), reply_text);
+ done();
+ });
server.start();
server.requestCall(function(event) {
diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js
index 410b050..3c062b9 100644
--- a/src/node/test/interop_sanity_test.js
+++ b/src/node/test/interop_sanity_test.js
@@ -52,7 +52,8 @@
it('should pass empty_unary', function(done) {
interop_client.runTest(port, name_override, 'empty_unary', true, done);
});
- it('should pass large_unary', function(done) {
+ // This fails due to an unknown bug
+ it.skip('should pass large_unary', function(done) {
interop_client.runTest(port, name_override, 'large_unary', true, done);
});
it('should pass client_streaming', function(done) {
@@ -64,7 +65,6 @@
it('should pass ping_pong', function(done) {
interop_client.runTest(port, name_override, 'ping_pong', true, done);
});
- // This depends on the new invoke API
it.skip('should pass empty_stream', function(done) {
interop_client.runTest(port, name_override, 'empty_stream', true, done);
});
diff --git a/src/node/test/server_test.js b/src/node/test/server_test.js
index 61aef46..457d13d 100644
--- a/src/node/test/server_test.js
+++ b/src/node/test/server_test.js
@@ -81,28 +81,7 @@
var call = new grpc.Call(channel,
'echo',
deadline);
- call.startInvoke(function(event) {
- assert.strictEqual(event.type,
- grpc.completionType.INVOKE_ACCEPTED);
- call.startWrite(
- new Buffer(req_text),
- function(event) {
- assert.strictEqual(event.type,
- grpc.completionType.WRITE_ACCEPTED);
- assert.strictEqual(event.data, grpc.opError.OK);
- call.writesDone(function(event) {
- assert.strictEqual(event.type,
- grpc.completionType.FINISH_ACCEPTED);
- assert.strictEqual(event.data, grpc.opError.OK);
- done();
- });
- }, 0);
- call.startRead(function(event) {
- assert.strictEqual(event.type, grpc.completionType.READ);
- assert.strictEqual(event.data.toString(), req_text);
- done();
- });
- },function(event) {
+ call.invoke(function(event) {
assert.strictEqual(event.type,
grpc.completionType.CLIENT_METADATA_READ);
done();
@@ -114,5 +93,23 @@
server.shutdown();
done();
}, 0);
+ call.startWrite(
+ new Buffer(req_text),
+ function(event) {
+ assert.strictEqual(event.type,
+ grpc.completionType.WRITE_ACCEPTED);
+ assert.strictEqual(event.data, grpc.opError.OK);
+ call.writesDone(function(event) {
+ assert.strictEqual(event.type,
+ grpc.completionType.FINISH_ACCEPTED);
+ assert.strictEqual(event.data, grpc.opError.OK);
+ done();
+ });
+ }, 0);
+ call.startRead(function(event) {
+ assert.strictEqual(event.type, grpc.completionType.READ);
+ assert.strictEqual(event.data.toString(), req_text);
+ done();
+ });
});
});
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c
index 410efbc..b171c9c 100644
--- a/src/php/ext/grpc/call.c
+++ b/src/php/ext/grpc/call.c
@@ -224,27 +224,25 @@
/**
* Invoke the RPC. Starts sending metadata and request headers over the wire
* @param CompletionQueue $queue The completion queue to use with this call
- * @param long $invoke_accepted_tag The tag to associate with this invocation
* @param long $metadata_tag The tag to associate with returned metadata
* @param long $finished_tag The tag to associate with the finished event
* @param long $flags A bitwise combination of the Grpc\WRITE_* constants
* (optional)
* @return Void
*/
-PHP_METHOD(Call, start_invoke) {
+PHP_METHOD(Call, invoke) {
grpc_call_error error_code;
long tag1;
long tag2;
- long tag3;
zval *queue_obj;
long flags = 0;
- /* "Olll|l" == 1 Object, 3 mandatory longs, 1 optional long */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Olll|l", &queue_obj,
- grpc_ce_completion_queue, &tag1, &tag2, &tag3,
+ /* "Oll|l" == 1 Object, 3 mandatory longs, 1 optional long */
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oll|l", &queue_obj,
+ grpc_ce_completion_queue, &tag1, &tag2,
&flags) == FAILURE) {
zend_throw_exception(
spl_ce_InvalidArgumentException,
- "start_invoke needs a CompletionQueue, 3 longs, and an optional long",
+ "invoke needs a CompletionQueue, 2 longs, and an optional long",
1 TSRMLS_CC);
return;
}
@@ -254,10 +252,9 @@
wrapped_grpc_completion_queue *queue =
(wrapped_grpc_completion_queue *)zend_object_store_get_object(
queue_obj TSRMLS_CC);
- error_code =
- grpc_call_start_invoke(call->wrapped, queue->wrapped, (void *)tag1,
- (void *)tag2, (void *)tag3, (gpr_uint32)flags);
- MAYBE_THROW_CALL_ERROR(start_invoke, error_code);
+ error_code = grpc_call_invoke(call->wrapped, queue->wrapped, (void *)tag1,
+ (void *)tag2, (gpr_uint32)flags);
+ MAYBE_THROW_CALL_ERROR(invoke, error_code);
}
/**
@@ -427,7 +424,7 @@
PHP_ME(Call, server_end_initial_metadata, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, add_metadata, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, cancel, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Call, start_invoke, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Call, invoke, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, start_read, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, start_write, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, start_write_status, NULL, ZEND_ACC_PUBLIC)
diff --git a/src/php/ext/grpc/credentials.c b/src/php/ext/grpc/credentials.c
index c63196b..46c825a 100644
--- a/src/php/ext/grpc/credentials.c
+++ b/src/php/ext/grpc/credentials.c
@@ -81,6 +81,8 @@
int root_certs_length, private_key_length = 0, cert_chain_length = 0;
+ pem_key_cert_pair.private_key = pem_key_cert_pair.cert_chain = NULL;
+
/* "s|s!s! == 1 string, 2 optional nullable strings */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!s!",
&pem_root_certs, &root_certs_length,
diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c
index e8b4643..492ac06 100644
--- a/src/php/ext/grpc/php_grpc.c
+++ b/src/php/ext/grpc/php_grpc.c
@@ -107,11 +107,9 @@
/* Register completion type constants */
REGISTER_LONG_CONSTANT("Grpc\\QUEUE_SHUTDOWN", GRPC_QUEUE_SHUTDOWN, CONST_CS);
REGISTER_LONG_CONSTANT("Grpc\\READ", GRPC_READ, CONST_CS);
- REGISTER_LONG_CONSTANT("Grpc\\INVOKE_ACCEPTED", GRPC_INVOKE_ACCEPTED,
- CONST_CS);
- REGISTER_LONG_CONSTANT("Grpc\\WRITE_ACCEPTED", GRPC_WRITE_ACCEPTED, CONST_CS);
REGISTER_LONG_CONSTANT("Grpc\\FINISH_ACCEPTED", GRPC_FINISH_ACCEPTED,
CONST_CS);
+ REGISTER_LONG_CONSTANT("Grpc\\WRITE_ACCEPTED", GRPC_WRITE_ACCEPTED, CONST_CS);
REGISTER_LONG_CONSTANT("Grpc\\CLIENT_METADATA_READ",
GRPC_CLIENT_METADATA_READ, CONST_CS);
REGISTER_LONG_CONSTANT("Grpc\\FINISHED", GRPC_FINISHED, CONST_CS);
diff --git a/src/php/lib/Grpc/ActiveCall.php b/src/php/lib/Grpc/ActiveCall.php
index aa66dbb..836a4b0 100755
--- a/src/php/lib/Grpc/ActiveCall.php
+++ b/src/php/lib/Grpc/ActiveCall.php
@@ -29,11 +29,8 @@
// Invoke the call.
$this->call->start_invoke($this->completion_queue,
- INVOKE_ACCEPTED,
CLIENT_METADATA_READ,
FINISHED, 0);
- $this->completion_queue->pluck(INVOKE_ACCEPTED,
- Timeval::inf_future());
$metadata_event = $this->completion_queue->pluck(CLIENT_METADATA_READ,
Timeval::inf_future());
$this->metadata = $metadata_event->data;
diff --git a/src/php/tests/unit_tests/CallTest.php b/src/php/tests/unit_tests/CallTest.php
index 253052a..795831c 100755
--- a/src/php/tests/unit_tests/CallTest.php
+++ b/src/php/tests/unit_tests/CallTest.php
@@ -19,10 +19,10 @@
/**
* @expectedException LogicException
* @expectedExceptionCode Grpc\CALL_ERROR_INVALID_FLAGS
- * @expectedExceptionMessage start_invoke
+ * @expectedExceptionMessage invoke
*/
- public function testStartInvokeRejectsBadFlags() {
- $this->call->start_invoke($this->cq, 0, 0, 0, 0xDEADBEEF);
+ public function testInvokeRejectsBadFlags() {
+ $this->call->invoke($this->cq, 0, 0, 0xDEADBEEF);
}
/**
diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php
index 3818f95..78c5e9f 100755
--- a/src/php/tests/unit_tests/EndToEndTest.php
+++ b/src/php/tests/unit_tests/EndToEndTest.php
@@ -25,18 +25,12 @@
$deadline);
$tag = 1;
$this->assertEquals(Grpc\CALL_OK,
- $call->start_invoke($this->client_queue,
- $tag,
- $tag,
- $tag));
+ $call->invoke($this->client_queue,
+ $tag,
+ $tag));
$server_tag = 2;
- // the client invocation was accepted
- $event = $this->client_queue->next($deadline);
- $this->assertNotNull($event);
- $this->assertEquals(Grpc\INVOKE_ACCEPTED, $event->type);
-
$call->writes_done($tag);
$event = $this->client_queue->next($deadline);
$this->assertNotNull($event);
@@ -103,18 +97,12 @@
$deadline);
$tag = 1;
$this->assertEquals(Grpc\CALL_OK,
- $call->start_invoke($this->client_queue,
- $tag,
- $tag,
- $tag));
+ $call->invoke($this->client_queue,
+ $tag,
+ $tag));
$server_tag = 2;
- // the client invocation was accepted
- $event = $this->client_queue->next($deadline);
- $this->assertNotNull($event);
- $this->assertEquals(Grpc\INVOKE_ACCEPTED, $event->type);
-
// the client writes
$call->start_write($req_text, $tag);
$event = $this->client_queue->next($deadline);
diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php
index c562a82..7c3ad8a 100755
--- a/src/php/tests/unit_tests/SecureEndToEndTest.php
+++ b/src/php/tests/unit_tests/SecureEndToEndTest.php
@@ -37,17 +37,11 @@
$deadline);
$tag = 1;
$this->assertEquals(Grpc\CALL_OK,
- $call->start_invoke($this->client_queue,
- $tag,
- $tag,
- $tag));
+ $call->invoke($this->client_queue,
+ $tag,
+ $tag));
$server_tag = 2;
- // the client invocation was accepted
- $event = $this->client_queue->next($deadline);
- $this->assertNotNull($event);
- $this->assertEquals(Grpc\INVOKE_ACCEPTED, $event->type);
-
$call->writes_done($tag);
$event = $this->client_queue->next($deadline);
$this->assertNotNull($event);
@@ -113,18 +107,12 @@
$deadline);
$tag = 1;
$this->assertEquals(Grpc\CALL_OK,
- $call->start_invoke($this->client_queue,
- $tag,
- $tag,
- $tag));
+ $call->invoke($this->client_queue,
+ $tag,
+ $tag));
$server_tag = 2;
- // the client invocation was accepted
- $event = $this->client_queue->next($deadline);
- $this->assertNotNull($event);
- $this->assertEquals(Grpc\INVOKE_ACCEPTED, $event->type);
-
// the client writes
$call->start_write($req_text, $tag);
$event = $this->client_queue->next($deadline);
diff --git a/src/python/_framework/foundation/_logging_pool_test.py b/src/python/_framework/foundation/_logging_pool_test.py
index ffe07c7..f2224d8 100644
--- a/src/python/_framework/foundation/_logging_pool_test.py
+++ b/src/python/_framework/foundation/_logging_pool_test.py
@@ -27,7 +27,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""Tests for google3.net.rpc.python.framework.foundation.logging_pool."""
+"""Tests for _framework.foundation.logging_pool."""
import unittest
diff --git a/src/ruby/README.md b/src/ruby/README.md
index 23aec2b..7f7558d 100755
--- a/src/ruby/README.md
+++ b/src/ruby/README.md
@@ -1,64 +1,63 @@
-Ruby for GRPC
-=============
+gRPC Ruby
+=========
-LAYOUT
-------
-
-Directory structure is the recommended layout for [ruby extensions](http://guides.rubygems.org/gems-with-extensions/)
-
- * ext: the extension code
- * lib: the entrypoint grpc ruby library to be used in a 'require' statement
- * test: tests
-
-
-DEPENDENCIES
-------------
-
-
-* Extension
-
-The extension can be built and tested using
-[rake](https://rubygems.org/gems/rake). However, the rake-extensiontask rule
-is not supported on older versions of rubygems, and the necessary version of
-rubygems.
-
-This is resolved by using [RVM](https://rvm.io/) instead; install a single-user
-ruby environment, and develop on the latest stable version of ruby (2.1.5).
+A Ruby implementation of gRPC, Google's RPC library.
INSTALLATION PREREQUISITES
--------------------------
-Install RVM
+This requires Ruby 2.x, as the rpc api surface uses keyword args.
+
+INSTALLING
+----------
+
+- Install the gRPC core library
+TODO: describe this, once the core distribution mechanism is defined.
+
+$ gem install grpc
+
+
+Installing from source
+----------------------
+
+- Build or Install the gRPC core
+E.g, from the root of the grpc [git repo](https://github.com/google/grpc)
+$ cd ../..
+$ make && sudo make install
+
+- Install Ruby 2.x. Consider doing this with [RVM](http://rvm.io), it's a nice way of controlling
+ the exact ruby version that's used.
$ command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
$
$ # follow the instructions to ensure that your're using the latest stable version of Ruby
$ # and that the rvm command is installed
-$
-$ gem install bundler # install bundler, the standard ruby package manager
-HACKING
--------
+- Install [bundler](http://bundler.io/)
+$ gem install bundler
-The extension can be built and tested using the Rakefile.
-
-$ # create a workspace
-$ git5 start <your-git5-branch> net/grpc
-$
-$ # build the C library and install it in $HOME/grpc_dev
-$ <google3>/net/grpc/c/build_gyp/build_grpc_dev.sh
-$
-$ # build the ruby extension and test it.
-$ cd google3_dir/net/grpc/ruby
-$ rake
-
-Finally, install grpc ruby locally.
-
-$ cd <this_dir>
-$
-$ # update the Gemfile, modify the line beginning # gem 'beefcake' to refer to
-$ # the patched beefcake dir
-$
+- Finally, install grpc ruby locally.
+$ cd <install_dir>
$ bundle install
+$ rake # compiles the extension, runs the unit tests, see rake -T for other options
+
+
+CONTENTS
+--------
+
+Directory structure is the layout for [ruby extensions](http://guides.rubygems.org/gems-with-extensions/)
+
+ * ext: the extension code
+ * lib: the entrypoint grpc ruby library to be used in a 'require' statement
+ * spec: tests
+ * bin: example gRPC clients and servers, e.g,
+```ruby
+# client
+stub = Math::Math::Stub.new('my.test.math.server.com:8080')
+req = Math::DivArgs.new(dividend: 7, divisor: 3)
+logger.info("div(7/3): req=#{req.inspect}")
+resp = stub.div(req, INFINITE_FUTURE)
+logger.info("Answer: #{resp.inspect}")
+```
diff --git a/src/ruby/bin/interop/README.md b/src/ruby/bin/interop/README.md
index 0402086..84fc663 100755
--- a/src/ruby/bin/interop/README.md
+++ b/src/ruby/bin/interop/README.md
@@ -1,11 +1,8 @@
Interop test protos
===================
-These were generated by a patched version of beefcake and a patched version of
-protoc.
+These ruby classes were generated with protoc v3, using grpc's ruby compiler
+plugin.
-- set up and access of the patched versions is described in ../../README.md
-
-The actual test proto is found in Google3 at
-
-- third_party/stubby/testing/proto/test.proto
+- As of 2015/01 protoc v3 is available in the
+[google-protobuf](https://github.com/google/protobuf) repo
diff --git a/src/ruby/bin/interop/interop_server.rb b/src/ruby/bin/interop/interop_server.rb
index 1a08eb9..8321282 100755
--- a/src/ruby/bin/interop/interop_server.rb
+++ b/src/ruby/bin/interop/interop_server.rb
@@ -145,8 +145,8 @@
end
def half_duplex_call(reqs)
- # TODO(temiola): clarify the behaviour of the half_duplex_call, it's not
- # currently used in any tests
+ # TODO: update with unique behaviour of the half_duplex_call if that's
+ # ever required by any of the tests.
full_duplex_call(reqs)
end
end
diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb
index a6dbbf3..cbf41ed 100644
--- a/src/ruby/ext/grpc/extconf.rb
+++ b/src/ruby/ext/grpc/extconf.rb
@@ -68,13 +68,9 @@
$CFLAGS << ' -Wall '
$CFLAGS << ' -pedantic '
-$LDFLAGS << ' -lgrpc -lgpr'
+$LDFLAGS << ' -lgrpc -lgpr -ldl'
-# crash('need grpc lib') unless have_library('grpc', 'grpc_channel_destroy')
-#
-# TODO(temiola): figure out why this stopped working, but the so is built OK
-# and the tests pass
-
+crash('need grpc lib') unless have_library('grpc', 'grpc_channel_destroy')
have_library('grpc', 'grpc_channel_destroy')
crash('need gpr lib') unless have_library('gpr', 'gpr_now')
create_makefile('grpc/grpc')
diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c
index 76b80bc..1b6565f 100644
--- a/src/ruby/ext/grpc/rb_call.c
+++ b/src/ruby/ext/grpc/rb_call.c
@@ -153,7 +153,7 @@
Add metadata elements to the call from a ruby hash, to be sent upon
invocation. flags is a bit-field combination of the write flags defined
- above. REQUIRES: grpc_call_start_invoke/grpc_call_accept have not been
+ above. REQUIRES: grpc_call_invoke/grpc_call_accept have not been
called on this call. Produces no events. */
static VALUE grpc_rb_call_add_metadata(int argc, VALUE *argv, VALUE self) {
@@ -196,16 +196,15 @@
/*
call-seq:
- call.start_invoke(completion_queue, tag, flags=nil)
+ call.invoke(completion_queue, tag, flags=nil)
Invoke the RPC. Starts sending metadata and request headers on the wire.
flags is a bit-field combination of the write flags defined above.
REQUIRES: Can be called at most once per call.
Can only be called on the client.
Produces a GRPC_INVOKE_ACCEPTED event on completion. */
-static VALUE grpc_rb_call_start_invoke(int argc, VALUE *argv, VALUE self) {
+static VALUE grpc_rb_call_invoke(int argc, VALUE *argv, VALUE self) {
VALUE cqueue = Qnil;
- VALUE invoke_accepted_tag = Qnil;
VALUE metadata_read_tag = Qnil;
VALUE finished_tag = Qnil;
VALUE flags = Qnil;
@@ -213,17 +212,16 @@
grpc_completion_queue *cq = NULL;
grpc_call_error err;
- /* "41" == 4 mandatory args, 1 (flags) is optional */
- rb_scan_args(argc, argv, "41", &cqueue, &invoke_accepted_tag,
- &metadata_read_tag, &finished_tag, &flags);
+ /* "31" == 3 mandatory args, 1 (flags) is optional */
+ rb_scan_args(argc, argv, "31", &cqueue, &metadata_read_tag, &finished_tag,
+ &flags);
if (NIL_P(flags)) {
flags = UINT2NUM(0); /* Default to no flags */
}
cq = grpc_rb_get_wrapped_completion_queue(cqueue);
Data_Get_Struct(self, grpc_call, call);
- err = grpc_call_start_invoke(call, cq, ROBJECT(invoke_accepted_tag),
- ROBJECT(metadata_read_tag),
- ROBJECT(finished_tag), NUM2UINT(flags));
+ err = grpc_call_invoke(call, cq, ROBJECT(metadata_read_tag),
+ ROBJECT(finished_tag), NUM2UINT(flags));
if (err != GRPC_CALL_OK) {
rb_raise(rb_eCallError, "invoke failed: %s (code=%d)",
grpc_call_error_detail_of(err), err);
@@ -519,7 +517,7 @@
grpc_rb_call_server_end_initial_metadata, -1);
rb_define_method(rb_cCall, "add_metadata", grpc_rb_call_add_metadata, -1);
rb_define_method(rb_cCall, "cancel", grpc_rb_call_cancel, 0);
- rb_define_method(rb_cCall, "start_invoke", grpc_rb_call_start_invoke, -1);
+ rb_define_method(rb_cCall, "invoke", grpc_rb_call_invoke, -1);
rb_define_method(rb_cCall, "start_read", grpc_rb_call_start_read, 1);
rb_define_method(rb_cCall, "start_write", grpc_rb_call_start_write, -1);
rb_define_method(rb_cCall, "start_write_status",
diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c
index c1b74e2..47776a9 100644
--- a/src/ruby/ext/grpc/rb_completion_queue.c
+++ b/src/ruby/ext/grpc/rb_completion_queue.c
@@ -75,7 +75,7 @@
grpc_completion_queue_shutdown(cq);
next_call.cq = cq;
next_call.event = NULL;
- /* TODO(temiola): the timeout should be a module level constant that defaults
+ /* TODO: the timeout should be a module level constant that defaults
* to gpr_inf_future.
*
* - at the moment this does not work, it stalls. Using a small timeout like
diff --git a/src/ruby/ext/grpc/rb_event.c b/src/ruby/ext/grpc/rb_event.c
index 0fae950..a1ab625 100644
--- a/src/ruby/ext/grpc/rb_event.c
+++ b/src/ruby/ext/grpc/rb_event.c
@@ -105,10 +105,6 @@
case GRPC_READ:
return rb_const_get(rb_mCompletionType, rb_intern("READ"));
- case GRPC_INVOKE_ACCEPTED:
- grpc_rb_event_result(self); /* validates the result */
- return rb_const_get(rb_mCompletionType, rb_intern("INVOKE_ACCEPTED"));
-
case GRPC_WRITE_ACCEPTED:
grpc_rb_event_result(self); /* validates the result */
return rb_const_get(rb_mCompletionType, rb_intern("WRITE_ACCEPTED"));
@@ -359,6 +355,8 @@
rb_define_const(rb_mCompletionType, "FINISHED", INT2NUM(GRPC_FINISHED));
rb_define_const(rb_mCompletionType, "SERVER_RPC_NEW",
INT2NUM(GRPC_SERVER_RPC_NEW));
+ rb_define_const(rb_mCompletionType, "SERVER_SHUTDOWN",
+ INT2NUM(GRPC_SERVER_SHUTDOWN));
rb_define_const(rb_mCompletionType, "RESERVED",
INT2NUM(GRPC_COMPLETION_DO_NOT_USE));
}
diff --git a/src/ruby/grpc.gemspec b/src/ruby/grpc.gemspec
index 8d7f44f..450362f 100755
--- a/src/ruby/grpc.gemspec
+++ b/src/ruby/grpc.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = 'grpc'
s.version = Google::RPC::VERSION
- s.authors = ['One Platform Team']
- s.email = 'stubby-team@google.com'
- s.homepage = 'http://go/grpc'
+ s.authors = ['gRPC Authors']
+ s.email = 'tbetbetbe@gmail.com'
+ s.homepage = 'https://github.com/google/grpc/tree/master/src/ruby'
s.summary = 'Google RPC system in Ruby'
- s.description = 'Send RPCs from Ruby'
+ s.description = 'Send RPCs from Ruby using Google\'s RPC system'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")
diff --git a/src/ruby/lib/grpc/beefcake.rb b/src/ruby/lib/grpc/beefcake.rb
deleted file mode 100644
index fd3ebbf..0000000
--- a/src/ruby/lib/grpc/beefcake.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 2014, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-require 'beefcake'
-
-module Beefcake
- # Re-open the beefcake message module to add a static encode
- #
- # This is a temporary measure while beefcake is used as the default proto
- # library for developing grpc ruby. Once that changes to the official proto
- # library this can be removed. It's necessary to allow the update the service
- # module to assume a static encode method.
- # TODO(temiola): remove this.
- module Message
- # additional mixin module that adds static encode method when include
- module StaticEncode
- # encodes o with its instance#encode method
- def encode(o)
- o.encode
- end
- end
-
- # extend self.included in Beefcake::Message to include StaticEncode
- def self.included(o)
- o.extend StaticEncode
- o.extend Dsl
- o.extend Decode
- o.send(:include, Encode)
- end
- end
-end
diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb
index bd684a8..1cdc168 100644
--- a/src/ruby/lib/grpc/generic/active_call.rb
+++ b/src/ruby/lib/grpc/generic/active_call.rb
@@ -47,7 +47,7 @@
include Core::TimeConsts
attr_reader(:deadline)
- # client_start_invoke begins a client invocation.
+ # client_invoke begins a client invocation.
#
# Flow Control note: this blocks until flow control accepts that client
# request can go ahead.
@@ -59,9 +59,9 @@
# if a keyword value is a list, multiple metadata for it's key are sent
#
# @param call [Call] a call on which to start and invocation
- # @param q [CompletionQueue] used to wait for INVOKE_ACCEPTED
- # @param deadline [Fixnum,TimeSpec] the deadline for INVOKE_ACCEPTED
- def self.client_start_invoke(call, q, _deadline, **kw)
+ # @param q [CompletionQueue] the completion queue
+ # @param deadline [Fixnum,TimeSpec] the deadline
+ def self.client_invoke(call, q, _deadline, **kw)
fail(ArgumentError, 'not a call') unless call.is_a? Core::Call
unless q.is_a? Core::CompletionQueue
fail(ArgumentError, 'not a CompletionQueue')
@@ -69,24 +69,16 @@
call.add_metadata(kw) if kw.length > 0
invoke_accepted, client_metadata_read = Object.new, Object.new
finished_tag = Object.new
- call.start_invoke(q, invoke_accepted, client_metadata_read,
- finished_tag)
-
- # wait for the invocation to be accepted
- ev = q.pluck(invoke_accepted, INFINITE_FUTURE)
- fail OutOfTime if ev.nil?
- ev.close
-
+ call.invoke(q, client_metadata_read, finished_tag)
[finished_tag, client_metadata_read]
end
# Creates an ActiveCall.
#
- # ActiveCall should only be created after a call is accepted. That means
- # different things on a client and a server. On the client, the call is
- # accepted after call.start_invoke followed by receipt of the
- # corresponding INVOKE_ACCEPTED. on the server, this is after
- # call.accept.
+ # ActiveCall should only be created after a call is accepted. That
+ # means different things on a client and a server. On the client, the
+ # call is accepted after calling call.invoke. On the server, this is
+ # after call.accept.
#
# #initialize cannot determine if the call is accepted or not; so if a
# call that's not accepted is used here, the error won't be visible until
@@ -495,7 +487,7 @@
private
def start_call(**kw)
- tags = ActiveCall.client_start_invoke(@call, @cq, @deadline, **kw)
+ tags = ActiveCall.client_invoke(@call, @cq, @deadline, **kw)
@finished_tag, @read_metadata_tag = tags
@started = true
end
diff --git a/src/ruby/lib/grpc/generic/bidi_call.rb b/src/ruby/lib/grpc/generic/bidi_call.rb
index 14ef6c5..099d571 100644
--- a/src/ruby/lib/grpc/generic/bidi_call.rb
+++ b/src/ruby/lib/grpc/generic/bidi_call.rb
@@ -50,9 +50,7 @@
#
# BidiCall should only be created after a call is accepted. That means
# different things on a client and a server. On the client, the call is
- # accepted after call.start_invoke followed by receipt of the
- # corresponding INVOKE_ACCEPTED. On the server, this is after
- # call.accept.
+ # accepted after call.invoke. On the server, this is after call.accept.
#
# #initialize cannot determine if the call is accepted or not; so if a
# call that's not accepted is used here, the error won't be visible until
@@ -142,7 +140,7 @@
# during bidi-streaming, read the requests to send from a separate thread
# read so that read_loop does not block waiting for requests to read.
def start_write_loop(requests, is_client: true)
- Thread.new do # TODO(temiola) run on a thread pool
+ Thread.new do # TODO: run on a thread pool
write_tag = Object.new
begin
count = 0
diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb
index 5ea3cc9..40c5ec1 100644
--- a/src/ruby/lib/grpc/generic/rpc_server.rb
+++ b/src/ruby/lib/grpc/generic/rpc_server.rb
@@ -233,10 +233,6 @@
end
def new_active_server_call(call, new_server_rpc)
- # TODO(temiola): perhaps reuse the main server completion queue here,
- # but for now, create a new completion queue per call, pending best
- # practice usage advice from the c core.
-
# Accept the call. This is necessary even if a status is to be sent
# back immediately
finished_tag = Object.new
@@ -340,7 +336,7 @@
@workers.size.times { schedule { throw :exit } }
@stopped = true
- # TODO(temiola): allow configuration of the keepalive period
+ # TODO: allow configuration of the keepalive period
keep_alive = 5
@stop_mutex.synchronize do
@stop_cond.wait(@stop_mutex, keep_alive) if @workers.size > 0
diff --git a/src/ruby/lib/grpc/logconfig.rb b/src/ruby/lib/grpc/logconfig.rb
index 6d8e189..6442f23 100644
--- a/src/ruby/lib/grpc/logconfig.rb
+++ b/src/ruby/lib/grpc/logconfig.rb
@@ -34,7 +34,7 @@
Logging.logger.root.appenders = Logging.appenders.stdout
Logging.logger.root.level = :info
-# TODO(temiola): provide command-line configuration for logging
+# TODO: provide command-line configuration for logging
Logging.logger['Google::RPC'].level = :debug
Logging.logger['Google::RPC::ActiveCall'].level = :info
Logging.logger['Google::RPC::BidiCall'].level = :info
diff --git a/src/ruby/spec/call_spec.rb b/src/ruby/spec/call_spec.rb
index b8ecd64..9a510df 100644
--- a/src/ruby/spec/call_spec.rb
+++ b/src/ruby/spec/call_spec.rb
@@ -122,24 +122,10 @@
end
end
- describe '#start_invoke' do
- it 'should cause the INVOKE_ACCEPTED event' do
- call = make_test_call
- expect(call.start_invoke(@client_queue, @tag, @tag, @tag)).to be_nil
- ev = @client_queue.next(deadline)
- expect(ev.call).to be_a(GRPC::Core::Call)
- expect(ev.tag).to be(@tag)
- expect(ev.type).to be(GRPC::Core::CompletionType::INVOKE_ACCEPTED)
- expect(ev.call).to_not be(call)
- end
- end
-
describe '#start_write' do
it 'should cause the WRITE_ACCEPTED event' do
call = make_test_call
- call.start_invoke(@client_queue, @tag, @tag, @tag)
- ev = @client_queue.next(deadline)
- expect(ev.type).to be(GRPC::Core::CompletionType::INVOKE_ACCEPTED)
+ call.invoke(@client_queue, @tag, @tag)
expect(call.start_write(GRPC::Core::ByteBuffer.new('test_start_write'),
@tag)).to be_nil
ev = @client_queue.next(deadline)
diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb
index 1bcbc66..b2afb05 100644
--- a/src/ruby/spec/client_server_spec.rb
+++ b/src/ruby/spec/client_server_spec.rb
@@ -83,10 +83,7 @@
def client_sends(call, sent = 'a message')
req = ByteBuffer.new(sent)
- call.start_invoke(@client_queue, @tag, @tag, @client_finished_tag)
- ev = @client_queue.pluck(@tag, TimeConsts::INFINITE_FUTURE)
- expect(ev).not_to be_nil
- expect(ev.type).to be(INVOKE_ACCEPTED)
+ call.invoke(@client_queue, @tag, @client_finished_tag)
call.start_write(req, @tag)
ev = @client_queue.pluck(@tag, TimeConsts::INFINITE_FUTURE)
expect(ev).not_to be_nil
@@ -233,8 +230,7 @@
call.add_metadata(md)
# Client begins a call OK
- call.start_invoke(@client_queue, @tag, @tag, @client_finished_tag)
- expect_next_event_on(@client_queue, INVOKE_ACCEPTED, @tag)
+ call.invoke(@client_queue, @tag, @client_finished_tag)
# ... server has all metadata available even though the client did not
# send a write
@@ -294,7 +290,7 @@
expect_next_event_on(@server_queue, WRITE_ACCEPTED, @server_tag)
# there is the HTTP status metadata, though there should not be any
- # TODO(temiola): update this with the bug number to be resolved
+ # TODO: update this with the bug number to be resolved
ev = expect_next_event_on(@client_queue, CLIENT_METADATA_READ, @tag)
expect(ev.result).to eq(':status' => '200')
end
diff --git a/src/ruby/spec/event_spec.rb b/src/ruby/spec/event_spec.rb
index 5dec07e..7ef08d0 100644
--- a/src/ruby/spec/event_spec.rb
+++ b/src/ruby/spec/event_spec.rb
@@ -40,7 +40,8 @@
CLIENT_METADATA_READ: 5,
FINISHED: 6,
SERVER_RPC_NEW: 7,
- RESERVED: 8
+ SERVER_SHUTDOWN: 8,
+ RESERVED: 9
}
end
diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb
index 898022f..443ba3d 100644
--- a/src/ruby/spec/generic/active_call_spec.rb
+++ b/src/ruby/spec/generic/active_call_spec.rb
@@ -60,8 +60,8 @@
describe 'restricted view methods' do
before(:each) do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
@client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
finished_tag: done_tag,
@@ -92,8 +92,8 @@
describe '#remote_send' do
it 'allows a client to send a payload to the server' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
@client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
finished_tag: done_tag,
@@ -118,8 +118,8 @@
it 'marshals the payload using the marshal func' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
marshal = proc { |x| 'marshalled:' + x }
client_call = ActiveCall.new(call, @client_queue, marshal,
@pass_through, deadline,
@@ -139,11 +139,11 @@
end
end
- describe '#client_start_invoke' do
+ describe '#client_invoke' do
it 'sends keywords as metadata to the server when the are present' do
call = make_test_call
- ActiveCall.client_start_invoke(call, @client_queue, deadline,
- k1: 'v1', k2: 'v2')
+ ActiveCall.client_invoke(call, @client_queue, deadline,
+ k1: 'v1', k2: 'v2')
@server.request_call(@server_tag)
ev = @server_queue.next(deadline)
expect(ev).to_not be_nil
@@ -155,8 +155,8 @@
describe '#remote_read' do
it 'reads the response sent by a server' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
finished_tag: done_tag,
@@ -170,8 +170,8 @@
it 'saves metadata { status=200 } when the server adds no metadata' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
finished_tag: done_tag,
@@ -187,8 +187,8 @@
it 'saves metadata add by the server' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
finished_tag: done_tag,
@@ -205,7 +205,7 @@
it 'get a nil msg before a status when an OK status is sent' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
@@ -224,8 +224,8 @@
it 'unmarshals the response using the unmarshal func' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
unmarshal = proc { |x| 'unmarshalled:' + x }
client_call = ActiveCall.new(call, @client_queue, @pass_through,
unmarshal, deadline,
@@ -251,8 +251,8 @@
it 'the returns an enumerator that can read n responses' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
finished_tag: done_tag,
@@ -271,8 +271,8 @@
it 'the returns an enumerator that stops after an OK Status' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
read_metadata_tag: meta_tag,
@@ -296,8 +296,8 @@
describe '#writes_done' do
it 'finishes ok if the server sends a status response' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
finished_tag: done_tag,
@@ -315,8 +315,8 @@
it 'finishes ok if the server sends an early status response' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
read_metadata_tag: meta_tag,
@@ -334,8 +334,8 @@
it 'finishes ok if writes_done is true' do
call = make_test_call
- done_tag, meta_tag = ActiveCall.client_start_invoke(call, @client_queue,
- deadline)
+ done_tag, meta_tag = ActiveCall.client_invoke(call, @client_queue,
+ deadline)
client_call = ActiveCall.new(call, @client_queue, @pass_through,
@pass_through, deadline,
read_metadata_tag: meta_tag,
diff --git a/src/ruby/spec/testdata/README b/src/ruby/spec/testdata/README
index ed72661..cb20dcb 100755
--- a/src/ruby/spec/testdata/README
+++ b/src/ruby/spec/testdata/README
@@ -1,4 +1 @@
These are test keys *NOT* to be used in production.
-http://go/keyhunt requires this README
-
-CONFIRMEDTESTKEY
diff --git a/test/core/echo/client.c b/test/core/echo/client.c
index 1905863..2ad29df 100644
--- a/test/core/echo/client.c
+++ b/test/core/echo/client.c
@@ -79,11 +79,8 @@
GPR_ASSERT(argc == 2);
channel = grpc_channel_create(argv[1], NULL);
call = grpc_channel_create_call(channel, "/foo", "localhost", gpr_inf_future);
- GPR_ASSERT(grpc_call_start_invoke(call, cq, (void *)1, (void *)1, (void *)1,
- 0) == GRPC_CALL_OK);
- ev = grpc_completion_queue_next(cq, gpr_inf_future);
- GPR_ASSERT(ev->data.invoke_accepted == GRPC_OP_OK);
- grpc_event_finish(ev);
+ GPR_ASSERT(grpc_call_invoke(call, cq, (void *)1, (void *)1, 0) ==
+ GRPC_CALL_OK);
start_write_next_slice(call, bytes_written, WRITE_SLICE_LENGTH);
bytes_written += WRITE_SLICE_LENGTH;
diff --git a/test/core/echo/echo_test.c b/test/core/echo/echo_test.c
index 16d381f..6449b24 100644
--- a/test/core/echo/echo_test.c
+++ b/test/core/echo/echo_test.c
@@ -42,10 +42,10 @@
#include <sys/wait.h>
#include "src/core/iomgr/socket_utils_posix.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include "test/core/util/port.h"
int test_client(const char *root, const char *host, int port) {
diff --git a/test/core/echo/server.c b/test/core/echo/server.c
index 35f118d..57b0837 100644
--- a/test/core/echo/server.c
+++ b/test/core/echo/server.c
@@ -39,11 +39,11 @@
#include <string.h>
#include <time.h>
+#include "src/core/support/string.h"
#include "test/core/util/test_config.h"
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/time.h>
#include "test/core/util/port.h"
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c
index 9fa5131..49b131c 100644
--- a/test/core/end2end/cq_verifier.c
+++ b/test/core/end2end/cq_verifier.c
@@ -45,10 +45,10 @@
#include <string.h>
#include "src/core/surface/event_string.h"
+#include "src/core/support/string.h"
#include <grpc/byte_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
@@ -56,8 +56,8 @@
typedef struct metadata {
size_t count;
size_t cap;
- const char **keys;
- const char **values;
+ char **keys;
+ char **values;
} metadata;
/* details what we expect to find on a single event - and forms a linked
@@ -70,7 +70,6 @@
union {
grpc_op_error finish_accepted;
grpc_op_error write_accepted;
- grpc_op_error invoke_accepted;
struct {
const char *method;
const char *host;
@@ -182,7 +181,7 @@
GPR_ASSERT(e->data.write_accepted == ev->data.write_accepted);
break;
case GRPC_INVOKE_ACCEPTED:
- GPR_ASSERT(e->data.invoke_accepted == ev->data.invoke_accepted);
+ abort();
break;
case GRPC_SERVER_RPC_NEW:
GPR_ASSERT(string_equivalent(e->data.server_rpc_new.method,
@@ -270,8 +269,7 @@
return sprintf(out, "GRPC_WRITE_ACCEPTED result=%d",
e->data.write_accepted);
case GRPC_INVOKE_ACCEPTED:
- return sprintf(out, "GRPC_INVOKE_ACCEPTED result=%d",
- e->data.invoke_accepted);
+ return sprintf(out, "GRPC_INVOKE_ACCEPTED");
case GRPC_SERVER_RPC_NEW:
timeout = gpr_time_sub(e->data.server_rpc_new.deadline, gpr_now());
return sprintf(out, "GRPC_SERVER_RPC_NEW method=%s host=%s timeout=%fsec",
@@ -409,20 +407,15 @@
if (md->cap == md->count) {
md->cap = GPR_MAX(md->cap + 1, md->cap * 3 / 2);
- md->keys = gpr_realloc(md->keys, sizeof(const char *) * md->cap);
- md->values = gpr_realloc(md->values, sizeof(const char *) * md->cap);
+ md->keys = gpr_realloc(md->keys, sizeof(char *) * md->cap);
+ md->values = gpr_realloc(md->values, sizeof(char *) * md->cap);
}
- md->keys[md->count] = key;
- md->values[md->count] = value;
+ md->keys[md->count] = (char *)key;
+ md->values[md->count] = (char *)value;
md->count++;
}
}
-void cq_expect_invoke_accepted(cq_verifier *v, void *tag,
- grpc_op_error result) {
- add(v, GRPC_INVOKE_ACCEPTED, tag)->data.invoke_accepted = result;
-}
-
void cq_expect_write_accepted(cq_verifier *v, void *tag, grpc_op_error result) {
add(v, GRPC_WRITE_ACCEPTED, tag)->data.write_accepted = result;
}
diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h
index a1966c1..6e031d8 100644
--- a/test/core/end2end/cq_verifier.h
+++ b/test/core/end2end/cq_verifier.h
@@ -56,7 +56,6 @@
Any functions taking ... expect a NULL terminated list of key/value pairs
(each pair using two parameter slots) of metadata that MUST be present in
the event. */
-void cq_expect_invoke_accepted(cq_verifier *v, void *tag, grpc_op_error result);
void cq_expect_write_accepted(cq_verifier *v, void *tag, grpc_op_error result);
void cq_expect_finish_accepted(cq_verifier *v, void *tag, grpc_op_error result);
void cq_expect_read(cq_verifier *v, void *tag, gpr_slice bytes);
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c
index 4327b91..6219f57 100644
--- a/test/core/end2end/dualstack_socket_test.c
+++ b/test/core/end2end/dualstack_socket_test.c
@@ -115,14 +115,10 @@
c = grpc_channel_create_call(client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, client_cq, tag(1), tag(2), tag(3), 0));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke(c, client_cq, tag(2), tag(3), 0));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
if (expect_ok) {
/* Check for a successful request. */
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
-
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
cq_verify(v_client);
@@ -152,11 +148,11 @@
grpc_call_destroy(s);
} else {
/* Check for a failed connection. */
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_ERROR);
cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_expect_finished_with_status(v_client, tag(3),
GRPC_STATUS_DEADLINE_EXCEEDED,
"Deadline Exceeded", NULL);
+ cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_ERROR);
cq_verify(v_client);
grpc_call_destroy(c);
diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c
index b9660f1..389a642 100644
--- a/test/core/end2end/no_server_test.c
+++ b/test/core/end2end/no_server_test.c
@@ -57,10 +57,8 @@
/* create a call, channel to a non existant server */
chan = grpc_channel_create("nonexistant:54321", NULL);
call = grpc_channel_create_call(chan, "/foo", "nonexistant", deadline);
- GPR_ASSERT(grpc_call_start_invoke(call, cq, tag(1), tag(2), tag(3), 0) ==
- GRPC_CALL_OK);
+ GPR_ASSERT(grpc_call_invoke(call, cq, tag(2), tag(3), 0) == GRPC_CALL_OK);
/* verify that all tags get completed */
- cq_expect_invoke_accepted(cqv, tag(1), GRPC_OP_ERROR);
cq_expect_client_metadata_read(cqv, tag(2), NULL);
cq_expect_finished_with_status(cqv, tag(3), GRPC_STATUS_DEADLINE_EXCEEDED,
"Deadline Exceeded", NULL);
diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c
index cfbb479..33aed98 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.c
@@ -117,9 +117,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, tag(100)));
cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com",
diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
index 74670bd..f348488 100644
--- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
+++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c
@@ -117,9 +117,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, tag(100)));
cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com",
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c
index d4cb5e4..3bb8672 100644
--- a/test/core/end2end/tests/cancel_after_invoke.c
+++ b/test/core/end2end/tests/cancel_after_invoke.c
@@ -115,9 +115,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c));
diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c
index f799cba..ac81648 100644
--- a/test/core/end2end/tests/cancel_before_invoke.c
+++ b/test/core/end2end/tests/cancel_before_invoke.c
@@ -115,8 +115,7 @@
GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c));
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_ERROR);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
cq_expect_client_metadata_read(v_client, tag(2), NULL);
cq_expect_finished_with_status(v_client, tag(3), GRPC_STATUS_CANCELLED, NULL,
NULL);
diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c
index baeed5c..719f0fe 100644
--- a/test/core/end2end/tests/census_simple_request.c
+++ b/test/core/end2end/tests/census_simple_request.c
@@ -109,9 +109,7 @@
GPR_ASSERT(c);
tag(1);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c
index b27a356..036fdc2 100644
--- a/test/core/end2end/tests/disappearing_server.c
+++ b/test/core/end2end/tests/disappearing_server.c
@@ -100,11 +100,8 @@
c = grpc_channel_create_call(f->client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_invoke(c, f->client_cq, tag(1),
- tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
-
- cq_verify(v_client);
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_invoke(c, f->client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
index 6ed0e4e..66e3c44 100644
--- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
+++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c
@@ -115,9 +115,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c
index 84ad4af..d9c9dbb 100644
--- a/test/core/end2end/tests/graceful_server_shutdown.c
+++ b/test/core/end2end/tests/graceful_server_shutdown.c
@@ -114,9 +114,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c
index fc46125..f187ece 100644
--- a/test/core/end2end/tests/invoke_large_request.c
+++ b/test/core/end2end/tests/invoke_large_request.c
@@ -126,9 +126,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_write(c, request_payload, tag(4), 0));
diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c
index 1db32b1..20f124e 100644
--- a/test/core/end2end/tests/max_concurrent_streams.c
+++ b/test/core/end2end/tests/max_concurrent_streams.c
@@ -113,9 +113,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
@@ -158,7 +156,6 @@
grpc_call *s1;
grpc_call *s2;
int live_call;
- grpc_call *live_call_obj;
gpr_timespec deadline;
cq_verifier *v_client;
cq_verifier *v_server;
@@ -192,26 +189,24 @@
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, tag(100)));
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_invoke(c1, f.client_cq, tag(300),
- tag(301), tag(302), 0));
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_invoke(c2, f.client_cq, tag(400),
- tag(401), tag(402), 0));
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_invoke(c1, f.client_cq, tag(301), tag(302), 0));
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_invoke(c2, f.client_cq, tag(401), tag(402), 0));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c1, tag(303)));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c2, tag(303)));
+
ev = grpc_completion_queue_next(
f.client_cq, gpr_time_add(gpr_now(), gpr_time_from_seconds(10)));
GPR_ASSERT(ev);
- GPR_ASSERT(ev->type == GRPC_INVOKE_ACCEPTED);
+ GPR_ASSERT(ev->type == GRPC_FINISH_ACCEPTED);
GPR_ASSERT(ev->data.invoke_accepted == GRPC_OP_OK);
/* The /alpha or /beta calls started above could be invoked (but NOT both);
* check this here */
- live_call = (int)(gpr_intptr) ev->tag;
- live_call_obj = live_call == 300 ? c1 : c2;
+ /* We'll get tag 303 or 403, we want 300, 400 */
+ live_call = ((int)(gpr_intptr) ev->tag) - 3;
grpc_event_finish(ev);
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_writes_done(live_call_obj, tag(live_call + 3)));
- cq_expect_finish_accepted(v_client, tag(live_call + 3), GRPC_OP_OK);
- cq_verify(v_client);
-
cq_expect_server_rpc_new(v_server, &s1, tag(100),
live_call == 300 ? "/alpha" : "/beta",
"test.google.com", deadline, NULL);
@@ -233,14 +228,8 @@
/* first request is finished, we should be able to start the second */
cq_expect_finished_with_status(v_client, tag(live_call + 2),
GRPC_STATUS_UNIMPLEMENTED, "xyz", NULL);
- live_call = (live_call == 300) ? 400 : 300;
- live_call_obj = live_call == 300 ? c1 : c2;
- cq_expect_invoke_accepted(v_client, tag(live_call), GRPC_OP_OK);
- cq_verify(v_client);
-
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_writes_done(live_call_obj, tag(live_call + 3)));
cq_expect_finish_accepted(v_client, tag(live_call + 3), GRPC_OP_OK);
+ live_call = (live_call == 300) ? 400 : 300;
cq_verify(v_client);
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, tag(200)));
diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c
index 03d549a..6768bd8 100644
--- a/test/core/end2end/tests/ping_pong_streaming.c
+++ b/test/core/end2end/tests/ping_pong_streaming.c
@@ -122,8 +122,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, tag(100)));
diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
index f58bf77..1dd798d 100644
--- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c
@@ -145,9 +145,7 @@
GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(c, &meta2, 0));
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_write(c, request_payload, tag(4), 0));
diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c
index 09923b2..cfc9b61 100644
--- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c
@@ -136,9 +136,7 @@
GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(c, &meta2, 0));
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_write(c, request_payload, tag(4), 0));
diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c
index be65bf1..32bf512 100644
--- a/test/core/end2end/tests/request_response_with_payload.c
+++ b/test/core/end2end/tests/request_response_with_payload.c
@@ -125,9 +125,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_write(c, request_payload, tag(4), 0));
diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
index d99141e..4f1de8b 100644
--- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
+++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c
@@ -138,9 +138,7 @@
GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(c, &meta2, 0));
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_write(c, request_payload, tag(4), 0));
diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c
index e2f554b..8362844 100644
--- a/test/core/end2end/tests/request_with_large_metadata.c
+++ b/test/core/end2end/tests/request_with_large_metadata.c
@@ -128,9 +128,7 @@
GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(c, &meta, 0));
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
cq_expect_server_rpc_new(v_server, &s, tag(100), "/foo", "test.google.com",
deadline, "key", meta.value, NULL);
diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c
index 09b3c86..a352783 100644
--- a/test/core/end2end/tests/request_with_payload.c
+++ b/test/core/end2end/tests/request_with_payload.c
@@ -122,9 +122,7 @@
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, tag(100)));
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write(c, payload, tag(4), 0));
/* destroy byte buffer early to ensure async code keeps track of its contents
diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c
index 90ed227..1e15eaa 100644
--- a/test/core/end2end/tests/simple_delayed_request.c
+++ b/test/core/end2end/tests/simple_delayed_request.c
@@ -106,10 +106,8 @@
c = grpc_channel_create_call(f->client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_invoke(c, f->client_cq, tag(1),
- tag(2), tag(3), 0));
- gpr_sleep_until(gpr_time_add(gpr_now(), gpr_time_from_micros(delay_us)));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_invoke(c, f->client_cq, tag(2), tag(3), 0));
config.init_server(f, server_args);
diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c
index 93dfa1f..23fc201 100644
--- a/test/core/end2end/tests/simple_request.c
+++ b/test/core/end2end/tests/simple_request.c
@@ -113,9 +113,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
@@ -161,9 +159,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);
diff --git a/test/core/end2end/tests/thread_stress.c b/test/core/end2end/tests/thread_stress.c
index 2de0497..6a3488e 100644
--- a/test/core/end2end/tests/thread_stress.c
+++ b/test/core/end2end/tests/thread_stress.c
@@ -106,25 +106,30 @@
/* Kick off a new request - assumes g_mu taken */
static void start_request(void) {
+ gpr_slice slice = gpr_slice_malloc(100);
+ grpc_byte_buffer *buf;
grpc_call *call = grpc_channel_create_call(
g_fixture.client, "/Foo", "test.google.com", g_test_end_time);
+
+ memset(GPR_SLICE_START_PTR(slice), 1, GPR_SLICE_LENGTH(slice));
+ buf = grpc_byte_buffer_create(&slice, 1);
+ gpr_slice_unref(slice);
+
g_active_requests++;
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_invoke(call, g_fixture.client_cq,
- NULL, NULL, NULL, 0));
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_invoke(call, g_fixture.client_cq, NULL, NULL, 0));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_read(call, NULL));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write(call, buf, NULL, 0));
+
+ grpc_byte_buffer_destroy(buf);
}
/* Async client: handle sending requests, reading responses, and starting
new requests when old ones finish */
static void client_thread(void *p) {
- int id = (gpr_intptr)p;
+ gpr_intptr id = (gpr_intptr)p;
grpc_event *ev;
- gpr_slice slice = gpr_slice_malloc(100);
- grpc_byte_buffer *buf;
char *estr;
- memset(GPR_SLICE_START_PTR(slice), id, GPR_SLICE_LENGTH(slice));
-
- buf = grpc_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
for (;;) {
ev = grpc_completion_queue_next(g_fixture.client_cq, n_seconds_time(1));
@@ -135,14 +140,6 @@
gpr_log(GPR_ERROR, "unexpected event: %s", estr);
gpr_free(estr);
break;
- case GRPC_INVOKE_ACCEPTED:
- /* better not keep going if the invoke failed */
- if (ev->data.invoke_accepted == GRPC_OP_OK) {
- GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_read(ev->call, NULL));
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_write(ev->call, buf, NULL, 0));
- }
- break;
case GRPC_READ:
break;
case GRPC_WRITE_ACCEPTED:
@@ -173,7 +170,6 @@
gpr_mu_unlock(&g_mu);
}
- grpc_byte_buffer_destroy(buf);
gpr_event_set(&g_client_done[id], (void *)1);
}
@@ -196,17 +192,17 @@
static void server_thread(void *p) {
int id = (gpr_intptr)p;
- grpc_event *ev;
gpr_slice slice = gpr_slice_malloc(100);
grpc_byte_buffer *buf;
+ grpc_event *ev;
char *estr;
- memset(GPR_SLICE_START_PTR(slice), id, GPR_SLICE_LENGTH(slice));
- request_server_call();
-
+ memset(GPR_SLICE_START_PTR(slice), 1, GPR_SLICE_LENGTH(slice));
buf = grpc_byte_buffer_create(&slice, 1);
gpr_slice_unref(slice);
+ request_server_call();
+
for (;;) {
ev = grpc_completion_queue_next(g_fixture.server_cq, n_seconds_time(1));
if (ev) {
diff --git a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c
index 9878b4c..eea4594 100644
--- a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c
+++ b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c
@@ -128,9 +128,7 @@
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(c, f.client_cq, tag(1), tag(2), tag(3), 0));
- cq_expect_invoke_accepted(v_client, tag(1), GRPC_OP_OK);
- cq_verify(v_client);
+ grpc_call_invoke(c, f.client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_write(c, request_payload, tag(4), 0));
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index 7e93860..7eb1958 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -55,9 +55,8 @@
static void step_ping_pong_request(void) {
call = grpc_channel_create_call(channel, "/Reflector/reflectUnary",
"localhost", gpr_inf_future);
- GPR_ASSERT(grpc_call_start_invoke(call, cq, (void *)1, (void *)1, (void *)1,
- GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK);
- grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
+ GPR_ASSERT(grpc_call_invoke(call, cq, (void *)1, (void *)1,
+ GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK);
GPR_ASSERT(grpc_call_start_write(call, the_buffer, (void *)1,
GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK);
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
@@ -66,7 +65,6 @@
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
- grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
grpc_call_destroy(call);
call = NULL;
}
@@ -74,9 +72,8 @@
static void init_ping_pong_stream(void) {
call = grpc_channel_create_call(channel, "/Reflector/reflectStream",
"localhost", gpr_inf_future);
- GPR_ASSERT(grpc_call_start_invoke(call, cq, (void *)1, (void *)1, (void *)1,
- 0) == GRPC_CALL_OK);
- grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
+ GPR_ASSERT(grpc_call_invoke(call, cq, (void *)1, (void *)1, 0) ==
+ GRPC_CALL_OK);
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
}
diff --git a/test/core/fling/fling_stream_test.c b/test/core/fling/fling_stream_test.c
index f6fe698..7f52fb1 100644
--- a/test/core/fling/fling_stream_test.c
+++ b/test/core/fling/fling_stream_test.c
@@ -41,9 +41,9 @@
#include <sys/types.h>
#include <sys/wait.h>
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
-#include <grpc/support/string.h>
#include "test/core/util/port.h"
int main(int argc, char **argv) {
diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_test.c
index 4607aa5..b2272f2 100644
--- a/test/core/fling/fling_test.c
+++ b/test/core/fling/fling_test.c
@@ -43,7 +43,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
-#include <grpc/support/string.h>
+#include "src/core/support/string.h"
#include "test/core/util/port.h"
int main(int argc, char **argv) {
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index 9c60f4c..ec21e0d 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -37,9 +37,9 @@
#include "src/core/httpcli/httpcli.h"
#include "src/core/security/json_token.h"
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/time.h>
#include "test/core/util/test_config.h"
#include <openssl/rsa.h>
diff --git a/test/core/support/string_test.c b/test/core/support/string_test.c
index e87a606..a01ec6f 100644
--- a/test/core/support/string_test.c
+++ b/test/core/support/string_test.c
@@ -31,7 +31,7 @@
*
*/
-#include <grpc/support/string.h>
+#include "src/core/support/string.h"
#include <stddef.h>
#include <stdlib.h>
diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c
index 0520a39..9b9f020 100644
--- a/test/core/surface/lame_client_test.c
+++ b/test/core/surface/lame_client_test.c
@@ -62,11 +62,9 @@
GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(call, &md, 0));
/* and invoke the call */
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_invoke(call, cq, tag(1), tag(2), tag(3), 0));
+ GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke(call, cq, tag(2), tag(3), 0));
/* the call should immediately fail */
- cq_expect_invoke_accepted(cqv, tag(1), GRPC_OP_ERROR);
cq_expect_client_metadata_read(cqv, tag(2), NULL);
cq_expect_finished(cqv, tag(3), NULL);
cq_verify(cqv);
diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c
index ea24f5c..048ed7e 100644
--- a/test/core/transport/chttp2/bin_encoder_test.c
+++ b/test/core/transport/chttp2/bin_encoder_test.c
@@ -35,9 +35,9 @@
#include <string.h>
+#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
static int all_ok = 1;
diff --git a/test/core/transport/chttp2/stream_encoder_test.c b/test/core/transport/chttp2/stream_encoder_test.c
index cebc263..eb0f688 100644
--- a/test/core/transport/chttp2/stream_encoder_test.c
+++ b/test/core/transport/chttp2/stream_encoder_test.c
@@ -35,10 +35,10 @@
#include <stdio.h>
+#include "src/core/support/string.h"
#include "src/core/transport/chttp2/hpack_parser.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
diff --git a/test/core/transport/chttp2/timeout_encoding_test.c b/test/core/transport/chttp2/timeout_encoding_test.c
index 4bb84e3..ffa0070 100644
--- a/test/core/transport/chttp2/timeout_encoding_test.c
+++ b/test/core/transport/chttp2/timeout_encoding_test.c
@@ -43,7 +43,7 @@
#define LOG_TEST() gpr_log(GPR_INFO, "%s", __FUNCTION__)
static void assert_encodes_as(gpr_timespec ts, const char *s) {
- char buffer[32];
+ char buffer[GRPC_CHTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
grpc_chttp2_encode_timeout(ts, buffer);
gpr_log(GPR_INFO, "check '%s' == '%s'", buffer, s);
GPR_ASSERT(0 == strcmp(buffer, s));
diff --git a/test/core/transport/transport_end2end_tests.c b/test/core/transport/transport_end2end_tests.c
index 712081b..8e9b4a2 100644
--- a/test/core/transport/transport_end2end_tests.c
+++ b/test/core/transport/transport_end2end_tests.c
@@ -37,10 +37,10 @@
#include <stdio.h>
#include <string.h>
+#include "src/core/support/string.h"
#include "src/core/transport/transport.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/string.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
@@ -129,7 +129,8 @@
/* Convert some number of seconds into a gpr_timespec that many seconds in the
future */
static gpr_timespec deadline_from_seconds(double deadline_seconds) {
- return gpr_time_add(gpr_now(), gpr_time_from_micros(deadline_seconds * 1e6));
+ return gpr_time_add(gpr_now(),
+ gpr_time_from_micros((long)(deadline_seconds * 1e6)));
}
/* Init a test_user_data instance */
@@ -573,7 +574,7 @@
name - the name of this test */
static void begin_test(test_fixture *f, grpc_transport_test_config *config,
const char *name) {
- gpr_timespec timeout = gpr_time_add(gpr_now(), gpr_time_from_micros(100e6));
+ gpr_timespec timeout = gpr_time_add(gpr_now(), gpr_time_from_seconds(100));
gpr_log(GPR_INFO, "BEGIN: %s/%s", name, config->name);
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c
index 6df86b5..5f3b55d 100644
--- a/test/core/util/test_config.c
+++ b/test/core/util/test_config.c
@@ -48,8 +48,10 @@
#endif
void grpc_test_init(int argc, char **argv) {
+#ifndef GPR_WIN32
/* disable SIGPIPE */
signal(SIGPIPE, SIG_IGN);
+#endif
/* seed rng with pid, so we don't end up with the same random numbers as a
concurrently running test binary */
srand(seed());
diff --git a/third_party/openssl b/third_party/openssl
index 2c5db8d..4ac0329 160000
--- a/third_party/openssl
+++ b/third_party/openssl
@@ -1 +1 @@
-Subproject commit 2c5db8dac3a06fe5b2c889838a606138ee3542ed
+Subproject commit 4ac0329582829f5378d8078c8d314ad37db87736
diff --git a/tools/dockerfile/grpc_go/Dockerfile b/tools/dockerfile/grpc_go/Dockerfile
new file mode 100644
index 0000000..1b99815
--- /dev/null
+++ b/tools/dockerfile/grpc_go/Dockerfile
@@ -0,0 +1,27 @@
+# Dockerfile for gRPC Go
+FROM golang:1.4
+
+# Install SSH to that Go source can be pulled securely.
+RUN apt-get update && apt-get install -y ssh
+
+# Install a GitHub SSH service credential that gives access to the GitHub repo while it's private
+#
+# TODO: remove this once the repo is public
+ADD .ssh .ssh
+RUN chmod 600 /.ssh/github.rsa
+RUN mkdir -p $HOME/.ssh && echo 'Host github.com' > $HOME/.ssh/config
+RUN echo " IdentityFile /.ssh/github.rsa" >> $HOME/.ssh/config
+RUN echo 'StrictHostKeyChecking no' >> $HOME/.ssh/config
+
+# Force go get to use the GitHub ssh url instead of https, and use the SSH creds
+RUN git config --global url."git@github.com:".insteadOf "https://github.com/"
+
+# Get the source from GitHub
+RUN go get github.com/google/grpc-go/rpc
+
+# Build the interop client and server
+RUN cd src/github.com/google/grpc-go/rpc/interop/client && go install
+RUN cd src/github.com/google/grpc-go/rpc/interop/server && go install
+
+# Specify the default command such that the interop server runs on its known testing port
+CMD ["/bin/bash", "-c", "cd src/github.com/google/grpc-go/rpc/interop/server && go run server.go --use_tls=true --port=8020"]
diff --git a/tools/dockerfile/grpc_go/README.md b/tools/dockerfile/grpc_go/README.md
new file mode 100644
index 0000000..0d6ad3e
--- /dev/null
+++ b/tools/dockerfile/grpc_go/README.md
@@ -0,0 +1,4 @@
+GRPC Go Dockerfile
+==================
+
+Dockerfile for gRPC Go development, testing and deployment.
diff --git a/tools/dockerfile/grpc_ruby/Dockerfile b/tools/dockerfile/grpc_ruby/Dockerfile
index 43ec018..c677cef 100644
--- a/tools/dockerfile/grpc_ruby/Dockerfile
+++ b/tools/dockerfile/grpc_ruby/Dockerfile
@@ -9,6 +9,9 @@
# Build the C core.
RUN make install_c -C /var/local/git/grpc
+# Install the grpc gem locally with its dependencies and build the extension
+RUN /bin/bash -l -c 'cd /var/local/git/grpc/src/ruby && bundle && rake compile:grpc && gem build grpc.gemspec && gem install grpc'
+
# TODO add a command to run the unittest tests when the bug below is fixed
# - the tests fail due to an error in the C threading library:
# they fail with 'ruby: __pthread_mutex_cond_lock_adjust for unknown reasons' at the end of a testcase
diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh
index bf77612..e61c83b 100755
--- a/tools/gce_setup/grpc_docker.sh
+++ b/tools/gce_setup/grpc_docker.sh
@@ -86,6 +86,7 @@
}
_grpc_update_image_args() {
+ echo "image_args $@"
# default the host, root storage uri and docker file root
grpc_gs_root='gs://tmp-grpc-dev/admin/'
grpc_dockerfile_root='tools/dockerfile'
@@ -95,7 +96,7 @@
# see if -p or -z is used to override the the project or zone
local OPTIND
local OPTARG
- while getopts :r:d:h name
+ while getopts :r:d:h: name
do
case $name in
d) grpc_dockerfile_root=$OPTARG ;;
@@ -261,7 +262,7 @@
local OPTIND
local OPTARG
local arg_func
- while getopts :p:z:f:n name
+ while getopts :np:z:f: name
do
case $name in
f) declare -F $OPTARG >> /dev/null && {
@@ -392,6 +393,65 @@
}
}
+_grpc_sync_scripts_args() {
+ grpc_gce_script_root='tools/gce_setup'
+
+ local OPTIND
+ local OPTARG
+ while getopts :s: name
+ do
+ case $name in
+ s) grpc_gce_script_root=$OPTARG ;;
+ :) continue ;; # ignore -s without args, just use the defaults
+ \?) echo "-$OPTARG: unknown flag; it's ignored" 1>&2; continue ;;
+ esac
+ done
+ shift $((OPTIND-1))
+
+ [[ -d $grpc_gce_script_root ]] || {
+ echo "Could not locate gce script dir: $grpc_gce_script_root" 1>&2
+ return 1
+ }
+
+ [[ $# -lt 1 ]] && {
+ echo "$FUNCNAME: missing arg: host1 [host2 ... hostN]" 1>&2
+ return 1
+ }
+ grpc_hosts="$@"
+}
+
+# Updates the latest version of the support scripts on some hosts.
+#
+# call-seq;
+# grpc_sync_scripts <server_name1>, <server_name2> .. <server_name3>
+#
+# Updates the GCE docker instance <server_name>
+grpc_sync_scripts() {
+ _grpc_ensure_gcloud_ssh || return 1;
+
+ # declare vars local so that they don't pollute the shell environment
+ # where they this func is used.
+ local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone
+ local grpc_hosts grpc_gce_script_root
+
+ # set the project zone and check that all necessary args are provided
+ _grpc_set_project_and_zone -f _grpc_sync_scripts_args "$@" || return 1
+
+ local func_lib="shared_startup_funcs.sh"
+ local gce_func_lib="/var/local/startup_scripts/$func_lib"
+ local project_opt="--project $grpc_project"
+ local zone_opt="--zone $grpc_zone"
+ local host
+ for host in $grpc_hosts
+ do
+ gce_has_instance $grpc_project $host || return 1;
+ # Update the remote copy of the GCE func library.
+ local src_func_lib="$grpc_gce_script_root/$func_lib"
+ local rmt_func_lib="$host:$gce_func_lib"
+ gcloud compute copy-files $src_func_lib $rmt_func_lib $project_opt $zone_opt || return 1
+ done
+}
+
grpc_sync_images_args() {
[[ $# -lt 1 ]] && {
echo "$FUNCNAME: missing arg: host1 [host2 ... hostN]" 1>&2
@@ -412,7 +472,6 @@
# declare vars local so that they don't pollute the shell environment
# where they this func is used.
local grpc_zone grpc_project dry_run # set by _grpc_set_project_and_zone
- # set by grpc_sync_images
local grpc_hosts
# set the project zone and check that all necessary args are provided
@@ -425,7 +484,7 @@
local host
for host in $grpc_hosts
do
- gce_has_instance $grpc_project $h || return 1;
+ gce_has_instance $grpc_project $host || return 1;
local ssh_cmd="bash -l -c \"$cmd\""
echo "will run:"
echo " $ssh_cmd"
@@ -575,6 +634,19 @@
echo $the_cmd
}
+# constructs the full dockerized Go interop test cmd.
+#
+# call-seq:
+# flags= .... # generic flags to include the command
+# cmd=$($grpc_gen_test_cmd $flags)
+grpc_interop_gen_go_cmd() {
+ local cmd_prefix="sudo docker run grpc/go /bin/bash -c"
+ local test_script="cd /go/src/github.com/google/grpc-go/rpc/interop/client"
+ local test_script+=" && go run client.go --use_tls=true"
+ local the_cmd="$cmd_prefix '$test_script $@'"
+ echo $the_cmd
+}
+
# constructs the full dockerized java interop test cmd.
#
# call-seq:
@@ -605,4 +677,4 @@
}
-# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python|cxx|nodejs|go
+# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python|cxx|nodejs
diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh
index 9c74746..f1dbca9 100755
--- a/tools/gce_setup/shared_startup_funcs.sh
+++ b/tools/gce_setup/shared_startup_funcs.sh
@@ -367,11 +367,12 @@
grpc_docker_pull_known() {
local addr=$1
[[ -n $addr ]] || addr="0.0.0.0:5000"
- local known="base cxx php_base php ruby_base ruby java_base java"
+ local known="base cxx php_base php ruby_base ruby java_base java go"
echo "... pulling docker images for '$known'"
for i in $known
do
- sudo docker pull ${addr}/grpc/$i \
+ echo "<--- grpc/$i"
+ sudo docker pull ${addr}/grpc/$i > /dev/null 2>&1 \
&& sudo docker tag ${addr}/grpc/$i grpc/$i || {
# log and continue
echo "docker op error: could not pull ${addr}/grpc/$i"
@@ -402,10 +403,15 @@
[[ -d $dockerfile_dir ]] || { echo "$FUNCNAME: not a valid dir: $dockerfile_dir"; return 1; }
- # For grpc/base, sync the ssh key into the .ssh dir in the dockerfile context
-
+ # For specific base images, sync the ssh key into the .ssh dir in the dockerfile context
[[ $image_label == "grpc/base" ]] && {
- grpc_docker_sync_github_key $dockerfile_dir/.ssh || return 1;
+ grpc_docker_sync_github_key $dockerfile_dir/.ssh 'base_ssh_key'|| return 1;
+ }
+ [[ $image_label == "grpc/go" ]] && {
+ grpc_docker_sync_github_key $dockerfile_dir/.ssh 'go_ssh_key'|| return 1;
+ }
+ [[ $image_label == "grpc/java_base" ]] && {
+ grpc_docker_sync_github_key $dockerfile_dir/.ssh 'java_base_ssh_key'|| return 1;
}
# TODO(temiola): maybe make cache/no-cache a func option?
@@ -445,6 +451,9 @@
local target_dir=$1
[[ -n $target_dir ]] || { echo "$FUNCNAME: missing arg: target_dir" >&2; return 1; }
+ local key_file=$2
+ [[ -n $key_file ]] || { echo "$FUNCNAME: missing arg: key_file" >&2; return 1; }
+
# determine the admin root; the parent of the dockerfile root,
local gs_dockerfile_root=$(load_metadata "attributes/gs_dockerfile_root")
[[ -n $gs_dockerfile_root ]] || {
@@ -454,7 +463,7 @@
local gcs_admin_root=$(dirname $gs_dockerfile_root)
# cp the file from gsutil to a known local area
- local gcs_key_path=$gcs_admin_root/github/ssh_key
+ local gcs_key_path=$gcs_admin_root/github/$key_file
local local_key_path=$target_dir/github.rsa
mkdir -p $target_dir || {
echo "$FUNCNAME: could not create dir: $target_dir" 1>&2
diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh
new file mode 100755
index 0000000..600b1bd
--- /dev/null
+++ b/tools/run_tests/build_node.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -ex
+
+# change to grpc repo root
+cd $(dirname $0)/../..
+
+# tells npm install to look for files in that directory
+export GRPC_ROOT=`pwd`
+# tells npm install the subdirectory with library files
+export GRPC_LIB_SUBDIR=libs/opt
+# tells npm install not to use default locations
+export GRPC_NO_INSTALL=yes
+
+# build the c libraries
+make -j static_c
+
+cd src/node
+
+npm install
diff --git a/vsprojects/third_party/openssl/OpenSSL.mak b/vsprojects/third_party/openssl/OpenSSL.mak
index 09344e8..8b11670 100644
--- a/vsprojects/third_party/openssl/OpenSSL.mak
+++ b/vsprojects/third_party/openssl/OpenSSL.mak
@@ -206,13 +206,13 @@
$(OBJ_D)\t1_lib.obj $(OBJ_D)\t1_enc.obj $(OBJ_D)\t1_ext.obj \
$(OBJ_D)\d1_meth.obj $(OBJ_D)\d1_srvr.obj $(OBJ_D)\d1_clnt.obj \
$(OBJ_D)\d1_lib.obj $(OBJ_D)\d1_pkt.obj $(OBJ_D)\d1_both.obj \
- $(OBJ_D)\d1_enc.obj $(OBJ_D)\d1_srtp.obj $(OBJ_D)\ssl_lib.obj \
- $(OBJ_D)\ssl_err2.obj $(OBJ_D)\ssl_cert.obj $(OBJ_D)\ssl_sess.obj \
- $(OBJ_D)\ssl_ciph.obj $(OBJ_D)\ssl_stat.obj $(OBJ_D)\ssl_rsa.obj \
- $(OBJ_D)\ssl_asn1.obj $(OBJ_D)\ssl_txt.obj $(OBJ_D)\ssl_algs.obj \
- $(OBJ_D)\ssl_conf.obj $(OBJ_D)\bio_ssl.obj $(OBJ_D)\ssl_err.obj \
- $(OBJ_D)\kssl.obj $(OBJ_D)\t1_reneg.obj $(OBJ_D)\tls_srp.obj \
- $(OBJ_D)\t1_trce.obj $(OBJ_D)\ssl_utst.obj
+ $(OBJ_D)\d1_srtp.obj $(OBJ_D)\ssl_lib.obj $(OBJ_D)\ssl_err2.obj \
+ $(OBJ_D)\ssl_cert.obj $(OBJ_D)\ssl_sess.obj $(OBJ_D)\ssl_ciph.obj \
+ $(OBJ_D)\ssl_stat.obj $(OBJ_D)\ssl_rsa.obj $(OBJ_D)\ssl_asn1.obj \
+ $(OBJ_D)\ssl_txt.obj $(OBJ_D)\ssl_algs.obj $(OBJ_D)\ssl_conf.obj \
+ $(OBJ_D)\bio_ssl.obj $(OBJ_D)\ssl_err.obj $(OBJ_D)\kssl.obj \
+ $(OBJ_D)\t1_reneg.obj $(OBJ_D)\tls_srp.obj $(OBJ_D)\t1_trce.obj \
+ $(OBJ_D)\ssl_utst.obj
CRYPTOOBJ=$(OBJ_D)\cryptlib.obj \
$(OBJ_D)\mem.obj $(OBJ_D)\mem_dbg.obj $(OBJ_D)\cversion.obj \
@@ -1277,9 +1277,6 @@
$(OBJ_D)\d1_both.obj: $(SRC_D)\ssl\d1_both.c
$(CC) /Fo$(OBJ_D)\d1_both.obj $(LIB_CFLAGS) -c $(SRC_D)\ssl\d1_both.c
-$(OBJ_D)\d1_enc.obj: $(SRC_D)\ssl\d1_enc.c
- $(CC) /Fo$(OBJ_D)\d1_enc.obj $(LIB_CFLAGS) -c $(SRC_D)\ssl\d1_enc.c
-
$(OBJ_D)\d1_srtp.obj: $(SRC_D)\ssl\d1_srtp.c
$(CC) /Fo$(OBJ_D)\d1_srtp.obj $(LIB_CFLAGS) -c $(SRC_D)\ssl\d1_srtp.c
diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj
index 05a9966..8249272 100644
--- a/vsprojects/vs2013/grpc.vcxproj
+++ b/vsprojects/vs2013/grpc.vcxproj
@@ -121,7 +121,9 @@
<ClInclude Include="..\..\src\core\iomgr\pollset.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_kick.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_kick_posix.h" />
+ <ClInclude Include="..\..\src\core\iomgr\pollset_kick_windows.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_posix.h" />
+ <ClInclude Include="..\..\src\core\iomgr\pollset_windows.h" />
<ClInclude Include="..\..\src\core\iomgr\resolve_address.h" />
<ClInclude Include="..\..\src\core\iomgr\sockaddr.h" />
<ClInclude Include="..\..\src\core\iomgr\sockaddr_posix.h" />
@@ -254,6 +256,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\pollset_posix.c">
</ClCompile>
+ <ClCompile Include="..\..\src\core\iomgr\pollset_windows.c">
+ </ClCompile>
<ClCompile Include="..\..\src\core\iomgr\resolve_address_posix.c">
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\sockaddr_utils.c">
diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj
index 05a9966..8249272 100644
--- a/vsprojects/vs2013/grpc_unsecure.vcxproj
+++ b/vsprojects/vs2013/grpc_unsecure.vcxproj
@@ -121,7 +121,9 @@
<ClInclude Include="..\..\src\core\iomgr\pollset.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_kick.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_kick_posix.h" />
+ <ClInclude Include="..\..\src\core\iomgr\pollset_kick_windows.h" />
<ClInclude Include="..\..\src\core\iomgr\pollset_posix.h" />
+ <ClInclude Include="..\..\src\core\iomgr\pollset_windows.h" />
<ClInclude Include="..\..\src\core\iomgr\resolve_address.h" />
<ClInclude Include="..\..\src\core\iomgr\sockaddr.h" />
<ClInclude Include="..\..\src\core\iomgr\sockaddr_posix.h" />
@@ -254,6 +256,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\pollset_posix.c">
</ClCompile>
+ <ClCompile Include="..\..\src\core\iomgr\pollset_windows.c">
+ </ClCompile>
<ClCompile Include="..\..\src\core\iomgr\resolve_address_posix.c">
</ClCompile>
<ClCompile Include="..\..\src\core\iomgr\sockaddr_utils.c">