diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2015-01-23 07:44:02 -0800 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2015-01-23 07:44:02 -0800 |
commit | ac139dead15bf9cb8da75340c6fb93225a11ef7c (patch) | |
tree | 20db86faa1cb4bcef299af17a93de7f7d6e44fe6 | |
parent | bdc52f6d3197f72cd495048d93f2a3a10cff3b38 (diff) | |
parent | e86076159ce9239479e454b2d2cc4b7858c48479 (diff) |
Merge pull request #153 from ctiller/windows-fixes
Windows fixes
27 files changed, 238 insertions, 21 deletions
@@ -1395,6 +1395,7 @@ LIBGRPC_SRC = \ 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/iomgr_posix.c: $(OPENSSL_DEP) 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/iomgr_posix.o: 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 @@ LIBGRPC_UNSECURE_SRC = \ 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/iomgr_posix.o: 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: diff --git a/build.json b/build.json index 31bec6cd9a..cacbfe2ae5 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/support/port_platform.h b/include/grpc/support/port_platform.h index 05a5bbe1bc..118a919aee 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/iomgr/endpoint_pair_posix.c b/src/core/iomgr/endpoint_pair_posix.c index f08d1344eb..3f53402cf3 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 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size) { 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 3cd2f9a8e0..9f70a26c64 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_readable(grpc_fd *fd, int allow_synchronous_callback) { 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 36d80d5c29..b9fcf45ea6 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 f088818b9a..02f3e41433 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 9f85b6137a..4386cf5a46 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 @@ void grpc_pollset_kick_kick(grpc_pollset_kick_state *kick_state) { } 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 0000000000..243e519dad --- /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 2555322532..39e2dc4667 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 @@ static void become_unary_pollset(grpc_pollset *pollset, grpc_fd *fd) { 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 0000000000..3fb39918b3 --- /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 0000000000..53b9ffa5ab --- /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 37ec0f0335..7b537b1767 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/socket_utils_common_posix.c b/src/core/iomgr/socket_utils_common_posix.c index bd29e2b5fd..3a0639f356 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> @@ -187,3 +191,5 @@ int grpc_create_dualstack_socket(const struct sockaddr *addr, int type, *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 d675c2dcec..851530ce68 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 @@ void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *ep), 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 657f34aaf9..64996bd07d 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> @@ -539,3 +543,5 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size) { 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 8ffd7d3569..c4d836e9b5 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 @@ void grpc_tcp_server_start(grpc_tcp_server *server, grpc_pollset *pollset, 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 e6c02186ee..2d6c6a73c2 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 @@ static int add_socket_to_server(grpc_tcp_server *s, int fd, 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 @@ void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset *pollset, } gpr_mu_unlock(&s->mu); } + +#endif diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c index c22a223737..00b020b31b 100644 --- a/src/core/transport/chttp2/frame_data.c +++ b/src/core/transport/chttp2/frame_data.c @@ -141,7 +141,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( 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 07b0f81098..64e08ffac7 100644 --- a/src/core/transport/chttp2/hpack_parser.c +++ b/src/core/transport/chttp2/hpack_parser.c @@ -1212,7 +1212,7 @@ static int huff_nibble(grpc_chttp2_hpack_parser *p, gpr_uint8 nibble) { 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_transport.c b/src/core/transport/chttp2_transport.c index e61afb71ae..17b37d6d4a 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1611,7 +1611,7 @@ static int process_read(transport *t, gpr_slice slice) { } 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 c77c8cde1f..555543fc4b 100644 --- a/src/core/transport/stream_op.c +++ b/src/core/transport/stream_op.c @@ -63,7 +63,7 @@ void grpc_sopb_reset(grpc_stream_op_buffer *sopb) { } 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/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 9fa513126f..7a7f197907 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -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 @@ -409,11 +409,11 @@ static metadata *metadata_from_args(va_list args) { 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++; } } diff --git a/test/core/transport/transport_end2end_tests.c b/test/core/transport/transport_end2end_tests.c index 712081bc8a..5d26ef53b9 100644 --- a/test/core/transport/transport_end2end_tests.c +++ b/test/core/transport/transport_end2end_tests.c @@ -129,7 +129,8 @@ static void expect_metadata(test_stream *s, int from_client, const char *key, /* 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 @@ static grpc_transport_setup_result setup_client_transport( 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 6df86b593f..5f3b55da75 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -48,8 +48,10 @@ static int seed(void) { return _getpid(); } #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/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index 05a9966c0e..8249272f78 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 05a9966c0e..8249272f78 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"> |