From 79b322751f6b6b0c11599235c5e62375c235783d Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 8 Aug 2016 13:38:30 -0700 Subject: refactor inet_ntop into a portability header --- tools/doxygen/Doxyfile.core.internal | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/doxygen/Doxyfile.core.internal') diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index dcb11bd933..57aefb4b3c 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -831,6 +831,7 @@ src/core/lib/iomgr/sockaddr.h \ src/core/lib/iomgr/sockaddr_posix.h \ src/core/lib/iomgr/sockaddr_utils.h \ src/core/lib/iomgr/sockaddr_windows.h \ +src/core/lib/iomgr/socket_utils.h \ src/core/lib/iomgr/socket_utils_posix.h \ src/core/lib/iomgr/socket_windows.h \ src/core/lib/iomgr/tcp_client.h \ @@ -990,6 +991,7 @@ src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_posix.c \ +src/core/lib/iomgr/socket_utils_windows.c \ src/core/lib/iomgr/socket_windows.c \ src/core/lib/iomgr/tcp_client_posix.c \ src/core/lib/iomgr/tcp_client_windows.c \ -- cgit v1.2.3 From 5407089b37581b010504171d939f5a3238411027 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 8 Aug 2016 17:01:18 -0700 Subject: Separate out iomgr-specific constants into a separate header --- BUILD | 4 ++ build.yaml | 1 + gRPC-Core.podspec | 2 + grpc.gemspec | 1 + include/grpc/impl/codegen/port_platform.h | 76 +------------------- package.xml | 1 + src/core/lib/iomgr/endpoint_pair_posix.c | 2 +- src/core/lib/iomgr/endpoint_pair_windows.c | 2 +- src/core/lib/iomgr/ev_epoll_linux.c | 2 +- src/core/lib/iomgr/ev_epoll_linux.h | 1 + src/core/lib/iomgr/ev_poll_and_epoll_posix.c | 2 +- src/core/lib/iomgr/ev_poll_posix.c | 2 +- src/core/lib/iomgr/ev_posix.c | 2 +- src/core/lib/iomgr/iocp_windows.c | 2 +- src/core/lib/iomgr/iomgr_posix.c | 2 +- src/core/lib/iomgr/iomgr_windows.c | 2 +- src/core/lib/iomgr/pollset_set_windows.c | 2 +- src/core/lib/iomgr/pollset_windows.c | 2 +- src/core/lib/iomgr/port.h | 83 +++++++++++++++++++++- src/core/lib/iomgr/resolve_address_posix.c | 2 +- src/core/lib/iomgr/resolve_address_windows.c | 2 +- src/core/lib/iomgr/sockaddr.h | 2 +- src/core/lib/iomgr/socket_utils.h | 2 + src/core/lib/iomgr/socket_utils_common_posix.c | 2 +- src/core/lib/iomgr/socket_utils_linux.c | 2 +- src/core/lib/iomgr/socket_utils_posix.c | 2 +- src/core/lib/iomgr/socket_utils_windows.c | 2 +- src/core/lib/iomgr/socket_windows.c | 2 +- src/core/lib/iomgr/tcp_client_posix.c | 2 +- src/core/lib/iomgr/tcp_client_windows.c | 2 +- src/core/lib/iomgr/tcp_posix.c | 2 +- src/core/lib/iomgr/tcp_server_posix.c | 2 +- src/core/lib/iomgr/tcp_server_windows.c | 2 +- src/core/lib/iomgr/tcp_windows.c | 2 +- src/core/lib/iomgr/udp_server.c | 2 +- src/core/lib/iomgr/unix_sockets_posix.c | 5 +- src/core/lib/iomgr/unix_sockets_posix.h | 2 +- src/core/lib/iomgr/wakeup_fd_eventfd.c | 2 +- src/core/lib/iomgr/wakeup_fd_nospecial.c | 2 +- src/core/lib/iomgr/wakeup_fd_pipe.c | 2 +- src/core/lib/iomgr/wakeup_fd_posix.c | 2 +- src/core/lib/iomgr/workqueue.h | 1 + src/core/lib/iomgr/workqueue_posix.c | 2 +- test/core/end2end/fixtures/h2_full+trace.c | 1 + test/core/end2end/fixtures/h2_sockpair+trace.c | 1 + test/core/iomgr/ev_epoll_linux_test.c | 2 +- test/core/util/port_posix.c | 2 +- test/core/util/port_windows.c | 2 +- test/cpp/end2end/async_end2end_test.cc | 1 + tools/doxygen/Doxyfile.core.internal | 1 + tools/run_tests/sources_and_headers.json | 2 + vsprojects/vcxproj/grpc/grpc.vcxproj | 1 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 3 + .../vcxproj/grpc_test_util/grpc_test_util.vcxproj | 1 + .../grpc_test_util/grpc_test_util.vcxproj.filters | 3 + .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 1 + .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 3 + 57 files changed, 154 insertions(+), 111 deletions(-) (limited to 'tools/doxygen/Doxyfile.core.internal') diff --git a/BUILD b/BUILD index e0e70459fd..c874341a98 100644 --- a/BUILD +++ b/BUILD @@ -195,6 +195,7 @@ cc_library( "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_windows.h", + "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr_posix.h", @@ -592,6 +593,7 @@ cc_library( "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_windows.h", + "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr_posix.h", @@ -948,6 +950,7 @@ cc_library( "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_windows.h", + "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr_posix.h", @@ -2065,6 +2068,7 @@ objc_library( "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_windows.h", + "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr_posix.h", diff --git a/build.yaml b/build.yaml index d0e1fe0b0f..39514bdef0 100644 --- a/build.yaml +++ b/build.yaml @@ -190,6 +190,7 @@ filegroups: - src/core/lib/iomgr/pollset_set.h - src/core/lib/iomgr/pollset_set_windows.h - src/core/lib/iomgr/pollset_windows.h + - src/core/lib/iomgr/port.h - src/core/lib/iomgr/resolve_address.h - src/core/lib/iomgr/sockaddr.h - src/core/lib/iomgr/sockaddr_posix.h diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 5a94fa9f1f..753dabebe4 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -288,6 +288,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/pollset_set.h', 'src/core/lib/iomgr/pollset_set_windows.h', 'src/core/lib/iomgr/pollset_windows.h', + 'src/core/lib/iomgr/port.h', 'src/core/lib/iomgr/resolve_address.h', 'src/core/lib/iomgr/sockaddr.h', 'src/core/lib/iomgr/sockaddr_posix.h', @@ -651,6 +652,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/pollset_set.h', 'src/core/lib/iomgr/pollset_set_windows.h', 'src/core/lib/iomgr/pollset_windows.h', + 'src/core/lib/iomgr/port.h', 'src/core/lib/iomgr/resolve_address.h', 'src/core/lib/iomgr/sockaddr.h', 'src/core/lib/iomgr/sockaddr_posix.h', diff --git a/grpc.gemspec b/grpc.gemspec index 4593a0a607..bb7913bf66 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -207,6 +207,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/pollset_set.h ) s.files += %w( src/core/lib/iomgr/pollset_set_windows.h ) s.files += %w( src/core/lib/iomgr/pollset_windows.h ) + s.files += %w( src/core/lib/iomgr/port.h ) s.files += %w( src/core/lib/iomgr/resolve_address.h ) s.files += %w( src/core/lib/iomgr/sockaddr.h ) s.files += %w( src/core/lib/iomgr/sockaddr_posix.h ) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index e51cc17460..1aeda9b658 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -90,10 +90,8 @@ #endif #define GPR_PLATFORM_STRING "windows" #define GPR_WINDOWS 1 -#define GPR_WINSOCK_SOCKET 1 #define GPR_WINDOWS_SUBPROCESS 1 #define GPR_WINDOWS_ENV -#define GPR_WINDOWS_SOCKETUTILS #ifdef __MSYS__ #define GPR_GETPID_IN_UNISTD_H 1 #define GPR_MSYS_TMPFILE @@ -125,15 +123,7 @@ #define GPR_GCC_TLS 1 #define GPR_LINUX 1 #define GPR_LINUX_LOG 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_POSIX_SOCKETADDR 1 -#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 -#define GPR_POSIX_SOCKETUTILS 1 #define GPR_SUPPORT_CHANNELS_FROM_FD 1 -#define GPR_HAVE_UNIX_SOCKET 1 -#define GPR_HAVE_IP_PKTINFO 1 -#define GPR_HAVE_IPV6_RECVPKTINFO 1 #define GPR_LINUX_ENV 1 #define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 @@ -142,7 +132,6 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 -#define GPR_HAVE_MSG_NOSIGNAL 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ @@ -159,12 +148,6 @@ #define GPR_CPU_LINUX 1 #define GPR_GCC_SYNC 1 #define GPR_GCC_TLS 1 -#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_LINUX_EVENTFD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 -#define GPR_POSIX_SOCKETUTILS 1 #define GPR_POSIX_ENV 1 #define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 @@ -175,10 +158,6 @@ #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 #define GPR_SUPPORT_CHANNELS_FROM_FD 1 -#define GPR_HAVE_MSG_NOSIGNAL 1 -#define GPR_HAVE_UNIX_SOCKET 1 -#define GPR_HAVE_IP_PKTINFO 1 -#define GPR_HAVE_IPV6_RECVPKTINFO 1 #elif defined(__linux__) #define GPR_POSIX_CRASH_HANDLER 1 #define GPR_PLATFORM_STRING "linux" @@ -197,30 +176,11 @@ #define GPR_GCC_TLS 1 #define GPR_LINUX 1 #define GPR_LINUX_LOG -#define GPR_LINUX_MULTIPOLL_WITH_EPOLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 #define GPR_SUPPORT_CHANNELS_FROM_FD 1 -#define GPR_HAVE_UNIX_SOCKET 1 -#define GPR_HAVE_IP_PKTINFO 1 -#define GPR_HAVE_IPV6_RECVPKTINFO 1 -#ifdef __GLIBC_PREREQ -#if __GLIBC_PREREQ(2, 9) -#define GPR_LINUX_EVENTFD 1 -#define GPR_LINUX_EPOLL 1 -#endif -#if __GLIBC_PREREQ(2, 10) -#define GPR_LINUX_SOCKETUTILS 1 -#endif -#endif #define GPR_LINUX_ENV 1 #ifndef GPR_LINUX_EVENTFD #define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 #endif -#ifndef GPR_LINUX_SOCKETUTILS -#define GPR_POSIX_SOCKETUTILS -#endif #define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 #define GPR_POSIX_STRING 1 @@ -228,7 +188,6 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 -#define GPR_HAVE_MSG_NOSIGNAL 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ @@ -239,7 +198,6 @@ #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif -#define GPR_MSG_IOVLEN_TYPE int #if TARGET_OS_IPHONE #define GPR_FORBID_UNREACHABLE_CODE 1 #define GPR_PLATFORM_STRING "ios" @@ -251,14 +209,9 @@ #define GPR_GCC_TLS 1 #define GPR_POSIX_CRASH_HANDLER 1 #endif +#define GPR_APPLE 1 #define GPR_GCC_ATOMIC 1 #define GPR_POSIX_LOG 1 -#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 -#define GPR_POSIX_SOCKETUTILS 1 #define GPR_POSIX_ENV 1 #define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 @@ -268,9 +221,6 @@ #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 #define GPR_SUPPORT_CHANNELS_FROM_FD 1 -#define GPR_HAVE_SO_NOSIGPIPE 1 -#define GPR_HAVE_UNIX_SOCKET 1 -#define GPR_HAVE_IP_PKTINFO 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ @@ -281,16 +231,11 @@ #ifndef _BSD_SOURCE #define _BSD_SOURCE #endif +#define GPR_FREEBSD 1 #define GPR_CPU_POSIX 1 #define GPR_GCC_ATOMIC 1 #define GPR_GCC_TLS 1 #define GPR_POSIX_LOG 1 -#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 -#define GPR_POSIX_SOCKETUTILS 1 #define GPR_POSIX_ENV 1 #define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 @@ -300,10 +245,6 @@ #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 #define GPR_SUPPORT_CHANNELS_FROM_FD 1 -#define GPR_HAVE_SO_NOSIGPIPE 1 -#define GPR_HAVE_UNIX_SOCKET 1 -#define GPR_HAVE_IP_PKTINFO 1 -#define GPR_HAVE_IPV6_RECVPKTINFO 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ @@ -320,16 +261,11 @@ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif +#define GPR_NACL 1 #define GPR_CPU_POSIX 1 #define GPR_GCC_ATOMIC 1 #define GPR_GCC_TLS 1 #define GPR_POSIX_LOG 1 -#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 -#define GPR_POSIX_SOCKETUTILS 1 #define GPR_POSIX_ENV 1 #define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 @@ -416,12 +352,6 @@ typedef unsigned __int64 uint64_t; #error Must define GPR_POSIX_SOCKET to use GPR_POSIX_MULTIPOLL_WITH_POLL #endif -#if defined(GPR_POSIX_SOCKET) + defined(GPR_WINSOCK_SOCKET) + \ - defined(GPR_CUSTOM_SOCKET) != \ - 1 -#error Must define exactly one of GPR_POSIX_SOCKET, GPR_WINSOCK_SOCKET, GPR_CUSTOM_SOCKET -#endif - #if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + \ defined(GPR_CUSTOM_TLS) != \ 1 diff --git a/package.xml b/package.xml index c735498757..3d5a83dc79 100644 --- a/package.xml +++ b/package.xml @@ -215,6 +215,7 @@ + diff --git a/src/core/lib/iomgr/endpoint_pair_posix.c b/src/core/lib/iomgr/endpoint_pair_posix.c index e295fb4867..7437dbf6ab 100644 --- a/src/core/lib/iomgr/endpoint_pair_posix.c +++ b/src/core/lib/iomgr/endpoint_pair_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/endpoint_pair_windows.c b/src/core/lib/iomgr/endpoint_pair_windows.c index 582704e267..0933ba0d57 100644 --- a/src/core/lib/iomgr/endpoint_pair_windows.c +++ b/src/core/lib/iomgr/endpoint_pair_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET #include "src/core/lib/iomgr/endpoint_pair.h" diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index 6a63c4d1d1..2d9c0e49b2 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -32,7 +32,7 @@ */ #include -#include +#include "src/core/lib/iomgr/port.h" /* This polling engine is only relevant on linux kernels supporting epoll() */ #ifdef GPR_LINUX_EPOLL diff --git a/src/core/lib/iomgr/ev_epoll_linux.h b/src/core/lib/iomgr/ev_epoll_linux.h index 7a494aba19..e2a66555bc 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.h +++ b/src/core/lib/iomgr/ev_epoll_linux.h @@ -34,6 +34,7 @@ #ifndef GRPC_CORE_LIB_IOMGR_EV_EPOLL_LINUX_H #define GRPC_CORE_LIB_IOMGR_EV_EPOLL_LINUX_H +#include "src/core/lib/iomgr/port.h" #include "src/core/lib/iomgr/ev_posix.h" const grpc_event_engine_vtable *grpc_init_epoll_linux(void); diff --git a/src/core/lib/iomgr/ev_poll_and_epoll_posix.c b/src/core/lib/iomgr/ev_poll_and_epoll_posix.c index c2107e5e39..57ae8325e8 100644 --- a/src/core/lib/iomgr/ev_poll_and_epoll_posix.c +++ b/src/core/lib/iomgr/ev_poll_and_epoll_posix.c @@ -42,7 +42,7 @@ * - ev_epoll_posix.{h,c} */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index 16a5e3083e..7df1b2e3de 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 6536672685..b510c6fc26 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/iocp_windows.c b/src/core/lib/iomgr/iocp_windows.c index 2532e52e48..e6915502a4 100644 --- a/src/core/lib/iomgr/iocp_windows.c +++ b/src/core/lib/iomgr/iocp_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/iomgr_posix.c b/src/core/lib/iomgr/iomgr_posix.c index cede97f4c6..963684ad7a 100644 --- a/src/core/lib/iomgr/iomgr_posix.c +++ b/src/core/lib/iomgr/iomgr_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/iomgr_windows.c b/src/core/lib/iomgr/iomgr_windows.c index 7653f6e635..e0e307bf81 100644 --- a/src/core/lib/iomgr/iomgr_windows.c +++ b/src/core/lib/iomgr/iomgr_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/pollset_set_windows.c b/src/core/lib/iomgr/pollset_set_windows.c index a35a9766fc..4a2563d32e 100644 --- a/src/core/lib/iomgr/pollset_set_windows.c +++ b/src/core/lib/iomgr/pollset_set_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #include #ifdef GPR_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c index 626dd784b3..bd650d5609 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/port.h b/src/core/lib/iomgr/port.h index 10b55d7453..acd68dce79 100644 --- a/src/core/lib/iomgr/port.h +++ b/src/core/lib/iomgr/port.h @@ -36,8 +36,89 @@ #ifndef GRPC_CORE_LIB_IOMGR_PORT_H #define GRPC_CORE_LIB_IOMGR_PORT_H -#if GPR_WINDOWS +#if defined(GPR_WINDOWS) #define GPR_WINSOCK_SOCKET 1 +#define GPR_WINDOWS_SOCKETUTILS 1 +/* #undef GPR_POSIX_SOCKET */ +/* #undef GPR_POSIX_WAKEUP_FD */ +#elif defined(GPR_MANYLINUX1) +#define GPR_HAVE_IPV6_RECVPKTINFO 1 +#define GPR_HAVE_IP_PKTINFO 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 +#define GPR_HAVE_UNIX_SOCKET 1 +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_WAKEUP_FD 1 +#elif defined(GPR_ANDROID) +#define GPR_HAVE_IPV6_RECVPKTINFO 1 +#define GPR_HAVE_IP_PKTINFO 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 +#define GPR_HAVE_UNIX_SOCKET 1 +#define GPR_LINUX_EVENTFD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_WAKEUP_FD 1 +#elif defined(GPR_LINUX) +#define GPR_HAVE_IPV6_RECVPKTINFO 1 +#define GPR_HAVE_IP_PKTINFO 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 +#define GPR_HAVE_UNIX_SOCKET 1 +#define GPR_LINUX_MULTIPOLL_WITH_EPOLL 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_WAKEUP_FD 1 +#ifdef __GLIBC_PREREQ +#if __GLIBC_PREREQ(2, 9) +#define GPR_LINUX_EPOLL 1 +#define GPR_LINUX_EVENTFD 1 +#endif +#if __GLIBC_PREREQ(2, 10) +#define GPR_LINUX_SOCKETUTILS 1 +#endif +#endif +#ifndef GPR_LINUX_EVENTFD +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#endif +#ifndef GPR_LINUX_SOCKETUTILS +#define GPR_POSIX_SOCKETUTILS +#endif +#elif defined(GPR_APPLE) +#define GPR_HAVE_IP_PKTINFO 1 +#define GPR_HAVE_SO_NOSIGPIPE 1 +#define GPR_HAVE_UNIX_SOCKET 1 +#define GPR_MSG_IOVLEN_TYPE int +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_WAKEUP_FD 1 +#elif defined(GPR_FREEBSD) +#define GPR_HAVE_IPV6_RECVPKTINFO 1 +#define GPR_HAVE_IP_PKTINFO 1 +#define GPR_HAVE_SO_NOSIGPIPE 1 +#define GPR_HAVE_UNIX_SOCKET 1 +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_WAKEUP_FD 1 +#elif defined(GPR_NACL) +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_WAKEUP_FD 1 +#elif !defined(GPR_NO_AUTODETECT_PLATFORM) +#error "Platform not recognized" +#endif +#if defined(GPR_POSIX_SOCKET) + defined(GPR_WINSOCK_SOCKET) + \ + defined(GPR_CUSTOM_SOCKET) != \ + 1 +#error Must define exactly one of GPR_POSIX_SOCKET, GPR_WINSOCK_SOCKET, GPR_CUSTOM_SOCKET +#endif #endif /* GRPC_CORE_LIB_IOMGR_PORT_H */ diff --git a/src/core/lib/iomgr/resolve_address_posix.c b/src/core/lib/iomgr/resolve_address_posix.c index 4e9f978584..164fe10855 100644 --- a/src/core/lib/iomgr/resolve_address_posix.c +++ b/src/core/lib/iomgr/resolve_address_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET #include "src/core/lib/iomgr/resolve_address.h" diff --git a/src/core/lib/iomgr/resolve_address_windows.c b/src/core/lib/iomgr/resolve_address_windows.c index 2af8af82dc..334473c6bf 100644 --- a/src/core/lib/iomgr/resolve_address_windows.c +++ b/src/core/lib/iomgr/resolve_address_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET #include "src/core/lib/iomgr/resolve_address.h" diff --git a/src/core/lib/iomgr/sockaddr.h b/src/core/lib/iomgr/sockaddr.h index 5563d0b8a6..fd85f176da 100644 --- a/src/core/lib/iomgr/sockaddr.h +++ b/src/core/lib/iomgr/sockaddr.h @@ -34,7 +34,7 @@ #ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_H #define GRPC_CORE_LIB_IOMGR_SOCKADDR_H -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINDOWS #include "src/core/lib/iomgr/sockaddr_windows.h" diff --git a/src/core/lib/iomgr/socket_utils.h b/src/core/lib/iomgr/socket_utils.h index 69774aac74..1d871a34e6 100644 --- a/src/core/lib/iomgr/socket_utils.h +++ b/src/core/lib/iomgr/socket_utils.h @@ -34,6 +34,8 @@ #ifndef GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H #define GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_H +#include "src/core/lib/iomgr/port.h" + #ifdef GPR_WINSOCK_SOCKET #include "sockaddr_windows.h" #else diff --git a/src/core/lib/iomgr/socket_utils_common_posix.c b/src/core/lib/iomgr/socket_utils_common_posix.c index e683ef8f18..afd9a7652e 100644 --- a/src/core/lib/iomgr/socket_utils_common_posix.c +++ b/src/core/lib/iomgr/socket_utils_common_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/socket_utils_linux.c b/src/core/lib/iomgr/socket_utils_linux.c index 144e3110c8..defdaf388e 100644 --- a/src/core/lib/iomgr/socket_utils_linux.c +++ b/src/core/lib/iomgr/socket_utils_linux.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_LINUX_SOCKETUTILS diff --git a/src/core/lib/iomgr/socket_utils_posix.c b/src/core/lib/iomgr/socket_utils_posix.c index 57ae64c103..a923ff870f 100644 --- a/src/core/lib/iomgr/socket_utils_posix.c +++ b/src/core/lib/iomgr/socket_utils_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKETUTILS diff --git a/src/core/lib/iomgr/socket_utils_windows.c b/src/core/lib/iomgr/socket_utils_windows.c index e4f9e2a510..c9ddce156b 100644 --- a/src/core/lib/iomgr/socket_utils_windows.c +++ b/src/core/lib/iomgr/socket_utils_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINDOWS_SOCKETUTILS diff --git a/src/core/lib/iomgr/socket_windows.c b/src/core/lib/iomgr/socket_windows.c index d7d5f6f157..e9d0cedce5 100644 --- a/src/core/lib/iomgr/socket_windows.c +++ b/src/core/lib/iomgr/socket_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/tcp_client_posix.c b/src/core/lib/iomgr/tcp_client_posix.c index 80c7a3f128..84b22d0c33 100644 --- a/src/core/lib/iomgr/tcp_client_posix.c +++ b/src/core/lib/iomgr/tcp_client_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/tcp_client_windows.c b/src/core/lib/iomgr/tcp_client_windows.c index 562cb9c6bf..2ae4834f99 100644 --- a/src/core/lib/iomgr/tcp_client_windows.c +++ b/src/core/lib/iomgr/tcp_client_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 974d5ae479..ba4dc75575 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/tcp_server_posix.c b/src/core/lib/iomgr/tcp_server_posix.c index 38ebd2dbcb..75241bd65d 100644 --- a/src/core/lib/iomgr/tcp_server_posix.c +++ b/src/core/lib/iomgr/tcp_server_posix.c @@ -36,7 +36,7 @@ #define _GNU_SOURCE #endif -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/tcp_server_windows.c b/src/core/lib/iomgr/tcp_server_windows.c index 1b125e7005..fd193c3fa2 100644 --- a/src/core/lib/iomgr/tcp_server_windows.c +++ b/src/core/lib/iomgr/tcp_server_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index 35054c42b5..0eecccb000 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/udp_server.c b/src/core/lib/iomgr/udp_server.c index 48032412a2..07eee75e5a 100644 --- a/src/core/lib/iomgr/udp_server.c +++ b/src/core/lib/iomgr/udp_server.c @@ -36,7 +36,7 @@ #define _GNU_SOURCE #endif -#include +#include "src/core/lib/iomgr/port.h" #ifdef GRPC_NEED_UDP #ifdef GPR_POSIX_SOCKET diff --git a/src/core/lib/iomgr/unix_sockets_posix.c b/src/core/lib/iomgr/unix_sockets_posix.c index 0e7670e5a5..c59d38848b 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.c +++ b/src/core/lib/iomgr/unix_sockets_posix.c @@ -30,8 +30,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -#include "src/core/lib/iomgr/unix_sockets_posix.h" +#include "src/core/lib/iomgr/port.h" #ifdef GPR_HAVE_UNIX_SOCKET @@ -40,6 +39,8 @@ #include #include +#include "src/core/lib/iomgr/unix_sockets_posix.h" + #include #include diff --git a/src/core/lib/iomgr/unix_sockets_posix.h b/src/core/lib/iomgr/unix_sockets_posix.h index db0516d945..5458f6ab4f 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.h +++ b/src/core/lib/iomgr/unix_sockets_posix.h @@ -34,7 +34,7 @@ #ifndef GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H #define GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H -#include +#include "src/core/lib/iomgr/port.h" #include diff --git a/src/core/lib/iomgr/wakeup_fd_eventfd.c b/src/core/lib/iomgr/wakeup_fd_eventfd.c index 95f6102330..3d21d9d1d5 100644 --- a/src/core/lib/iomgr/wakeup_fd_eventfd.c +++ b/src/core/lib/iomgr/wakeup_fd_eventfd.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_LINUX_EVENTFD diff --git a/src/core/lib/iomgr/wakeup_fd_nospecial.c b/src/core/lib/iomgr/wakeup_fd_nospecial.c index cb2f707dc5..c2b273d3a6 100644 --- a/src/core/lib/iomgr/wakeup_fd_nospecial.c +++ b/src/core/lib/iomgr/wakeup_fd_nospecial.c @@ -36,7 +36,7 @@ * systems without anything better than pipe. */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_NO_SPECIAL_WAKEUP_FD diff --git a/src/core/lib/iomgr/wakeup_fd_pipe.c b/src/core/lib/iomgr/wakeup_fd_pipe.c index 4e5dbdcb73..8991d17741 100644 --- a/src/core/lib/iomgr/wakeup_fd_pipe.c +++ b/src/core/lib/iomgr/wakeup_fd_pipe.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_WAKEUP_FD diff --git a/src/core/lib/iomgr/wakeup_fd_posix.c b/src/core/lib/iomgr/wakeup_fd_posix.c index 046208abc8..c5c4eeb62e 100644 --- a/src/core/lib/iomgr/wakeup_fd_posix.c +++ b/src/core/lib/iomgr/wakeup_fd_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_WAKEUP_FD diff --git a/src/core/lib/iomgr/workqueue.h b/src/core/lib/iomgr/workqueue.h index 7156e490d7..86c7114c31 100644 --- a/src/core/lib/iomgr/workqueue.h +++ b/src/core/lib/iomgr/workqueue.h @@ -39,6 +39,7 @@ #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset_set.h" +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET #include "src/core/lib/iomgr/workqueue_posix.h" diff --git a/src/core/lib/iomgr/workqueue_posix.c b/src/core/lib/iomgr/workqueue_posix.c index e0d6dac230..2665b9580f 100644 --- a/src/core/lib/iomgr/workqueue_posix.c +++ b/src/core/lib/iomgr/workqueue_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #ifdef GPR_POSIX_SOCKET diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index c4dc5b9bc1..ad31d21fef 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -45,6 +45,7 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/http_server_filter.h" +#include "src/core/lib/iomgr/port.h" #include "src/core/lib/support/env.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 6b0769b608..429c2013d3 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -48,6 +48,7 @@ #include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" +#include "src/core/lib/iomgr/port.h" #include "src/core/lib/support/env.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/completion_queue.h" diff --git a/test/core/iomgr/ev_epoll_linux_test.c b/test/core/iomgr/ev_epoll_linux_test.c index 2547dc9871..d7ee6da7c6 100644 --- a/test/core/iomgr/ev_epoll_linux_test.c +++ b/test/core/iomgr/ev_epoll_linux_test.c @@ -30,7 +30,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#include +#include "src/core/lib/iomgr/port.h" /* This test only relevant on linux systems where epoll() is available */ #ifdef GPR_LINUX_EPOLL diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c index 265e0acee1..6e3ab64edd 100644 --- a/test/core/util/port_posix.c +++ b/test/core/util/port_posix.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #include "test/core/util/test_config.h" #if defined(GPR_POSIX_SOCKET) && defined(GRPC_TEST_PICK_PORT) diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c index 9023719675..4cc0cea0cb 100644 --- a/test/core/util/port_windows.c +++ b/test/core/util/port_windows.c @@ -31,7 +31,7 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" #include "test/core/util/test_config.h" #if defined(GPR_WINSOCK_SOCKET) && defined(GRPC_TEST_PICK_PORT) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index ac79fe8274..662ccbd1c2 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -47,6 +47,7 @@ #include #include +#include "src/core/lib/iomgr/port.h" #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 57aefb4b3c..8f2f011eaf 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -826,6 +826,7 @@ src/core/lib/iomgr/pollset.h \ src/core/lib/iomgr/pollset_set.h \ src/core/lib/iomgr/pollset_set_windows.h \ src/core/lib/iomgr/pollset_windows.h \ +src/core/lib/iomgr/port.h \ src/core/lib/iomgr/resolve_address.h \ src/core/lib/iomgr/sockaddr.h \ src/core/lib/iomgr/sockaddr_posix.h \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 42faca3ee5..8c1cd249ba 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -5801,6 +5801,7 @@ "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_windows.h", + "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr_posix.h", @@ -5926,6 +5927,7 @@ "src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/pollset_windows.h", + "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/resolve_address_posix.c", "src/core/lib/iomgr/resolve_address_windows.c", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 4166b1b08c..69ec3c0a08 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -335,6 +335,7 @@ + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 5608139f53..d72c32046a 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -776,6 +776,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index f7006c81cd..84e2a60d58 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -225,6 +225,7 @@ + diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index 22f542bda1..1a2ecf91df 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -554,6 +554,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index c359163412..d053dd9a30 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -324,6 +324,7 @@ + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index cf4e4a0a3c..7edd0db4b6 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -683,6 +683,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr -- cgit v1.2.3 From 7c205906d5d47cfaa9a7e4729bbd71821e3bb5bd Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 9 Aug 2016 10:07:42 -0700 Subject: Removed GPR_POSIX_FILE, and changed the files that used it --- BUILD | 9 ++-- CMakeLists.txt | 6 +-- Makefile | 9 ++-- binding.gyp | 3 +- build.yaml | 3 +- config.m4 | 3 +- gRPC-Core.podspec | 3 +- grpc.gemspec | 3 +- include/grpc/impl/codegen/port_platform.h | 6 --- package.xml | 3 +- .../google_default/credentials_generic.c | 59 +++++++++++++++++++++ .../credentials/google_default/credentials_posix.c | 61 ---------------------- .../google_default/credentials_windows.c | 61 ---------------------- .../google_default/google_default_credentials.h | 12 +++++ src/python/grpcio/grpc_core_dependencies.py | 3 +- test/core/security/credentials_test.c | 22 +++----- tools/doxygen/Doxyfile.core.internal | 3 +- tools/run_tests/sources_and_headers.json | 3 +- vsprojects/vcxproj/grpc/grpc.vcxproj | 4 +- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 5 +- 20 files changed, 97 insertions(+), 184 deletions(-) create mode 100644 src/core/lib/security/credentials/google_default/credentials_generic.c delete mode 100644 src/core/lib/security/credentials/google_default/credentials_posix.c delete mode 100644 src/core/lib/security/credentials/google_default/credentials_windows.c (limited to 'tools/doxygen/Doxyfile.core.internal') diff --git a/BUILD b/BUILD index c874341a98..056e91a9e2 100644 --- a/BUILD +++ b/BUILD @@ -436,8 +436,7 @@ cc_library( "src/core/lib/security/credentials/credentials.c", "src/core/lib/security/credentials/credentials_metadata.c", "src/core/lib/security/credentials/fake/fake_credentials.c", - "src/core/lib/security/credentials/google_default/credentials_posix.c", - "src/core/lib/security/credentials/google_default/credentials_windows.c", + "src/core/lib/security/credentials/google_default/credentials_generic.c", "src/core/lib/security/credentials/google_default/google_default_credentials.c", "src/core/lib/security/credentials/iam/iam_credentials.c", "src/core/lib/security/credentials/jwt/json_token.c", @@ -843,8 +842,7 @@ cc_library( "src/core/lib/security/credentials/credentials.c", "src/core/lib/security/credentials/credentials_metadata.c", "src/core/lib/security/credentials/fake/fake_credentials.c", - "src/core/lib/security/credentials/google_default/credentials_posix.c", - "src/core/lib/security/credentials/google_default/credentials_windows.c", + "src/core/lib/security/credentials/google_default/credentials_generic.c", "src/core/lib/security/credentials/google_default/google_default_credentials.c", "src/core/lib/security/credentials/iam/iam_credentials.c", "src/core/lib/security/credentials/jwt/json_token.c", @@ -1932,8 +1930,7 @@ objc_library( "src/core/lib/security/credentials/credentials.c", "src/core/lib/security/credentials/credentials_metadata.c", "src/core/lib/security/credentials/fake/fake_credentials.c", - "src/core/lib/security/credentials/google_default/credentials_posix.c", - "src/core/lib/security/credentials/google_default/credentials_windows.c", + "src/core/lib/security/credentials/google_default/credentials_generic.c", "src/core/lib/security/credentials/google_default/google_default_credentials.c", "src/core/lib/security/credentials/iam/iam_credentials.c", "src/core/lib/security/credentials/jwt/json_token.c", diff --git a/CMakeLists.txt b/CMakeLists.txt index fdb730b983..ac7218236e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -397,8 +397,7 @@ add_library(grpc src/core/lib/security/credentials/credentials.c src/core/lib/security/credentials/credentials_metadata.c src/core/lib/security/credentials/fake/fake_credentials.c - src/core/lib/security/credentials/google_default/credentials_posix.c - src/core/lib/security/credentials/google_default/credentials_windows.c + src/core/lib/security/credentials/google_default/credentials_generic.c src/core/lib/security/credentials/google_default/google_default_credentials.c src/core/lib/security/credentials/iam/iam_credentials.c src/core/lib/security/credentials/jwt/json_token.c @@ -676,8 +675,7 @@ add_library(grpc_cronet src/core/lib/security/credentials/credentials.c src/core/lib/security/credentials/credentials_metadata.c src/core/lib/security/credentials/fake/fake_credentials.c - src/core/lib/security/credentials/google_default/credentials_posix.c - src/core/lib/security/credentials/google_default/credentials_windows.c + src/core/lib/security/credentials/google_default/credentials_generic.c src/core/lib/security/credentials/google_default/google_default_credentials.c src/core/lib/security/credentials/iam/iam_credentials.c src/core/lib/security/credentials/jwt/json_token.c diff --git a/Makefile b/Makefile index 8b6af559e0..e85633f8eb 100644 --- a/Makefile +++ b/Makefile @@ -2645,8 +2645,7 @@ LIBGRPC_SRC = \ src/core/lib/security/credentials/credentials.c \ src/core/lib/security/credentials/credentials_metadata.c \ src/core/lib/security/credentials/fake/fake_credentials.c \ - src/core/lib/security/credentials/google_default/credentials_posix.c \ - src/core/lib/security/credentials/google_default/credentials_windows.c \ + src/core/lib/security/credentials/google_default/credentials_generic.c \ src/core/lib/security/credentials/google_default/google_default_credentials.c \ src/core/lib/security/credentials/iam/iam_credentials.c \ src/core/lib/security/credentials/jwt/json_token.c \ @@ -2944,8 +2943,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/security/credentials/credentials.c \ src/core/lib/security/credentials/credentials_metadata.c \ src/core/lib/security/credentials/fake/fake_credentials.c \ - src/core/lib/security/credentials/google_default/credentials_posix.c \ - src/core/lib/security/credentials/google_default/credentials_windows.c \ + src/core/lib/security/credentials/google_default/credentials_generic.c \ src/core/lib/security/credentials/google_default/google_default_credentials.c \ src/core/lib/security/credentials/iam/iam_credentials.c \ src/core/lib/security/credentials/jwt/json_token.c \ @@ -15188,8 +15186,7 @@ src/core/lib/security/credentials/composite/composite_credentials.c: $(OPENSSL_D src/core/lib/security/credentials/credentials.c: $(OPENSSL_DEP) src/core/lib/security/credentials/credentials_metadata.c: $(OPENSSL_DEP) src/core/lib/security/credentials/fake/fake_credentials.c: $(OPENSSL_DEP) -src/core/lib/security/credentials/google_default/credentials_posix.c: $(OPENSSL_DEP) -src/core/lib/security/credentials/google_default/credentials_windows.c: $(OPENSSL_DEP) +src/core/lib/security/credentials/google_default/credentials_generic.c: $(OPENSSL_DEP) src/core/lib/security/credentials/google_default/google_default_credentials.c: $(OPENSSL_DEP) src/core/lib/security/credentials/iam/iam_credentials.c: $(OPENSSL_DEP) src/core/lib/security/credentials/jwt/json_token.c: $(OPENSSL_DEP) diff --git a/binding.gyp b/binding.gyp index a078e5cca8..b03da7cb58 100644 --- a/binding.gyp +++ b/binding.gyp @@ -682,8 +682,7 @@ 'src/core/lib/security/credentials/credentials.c', 'src/core/lib/security/credentials/credentials_metadata.c', 'src/core/lib/security/credentials/fake/fake_credentials.c', - 'src/core/lib/security/credentials/google_default/credentials_posix.c', - 'src/core/lib/security/credentials/google_default/credentials_windows.c', + 'src/core/lib/security/credentials/google_default/credentials_generic.c', 'src/core/lib/security/credentials/google_default/google_default_credentials.c', 'src/core/lib/security/credentials/iam/iam_credentials.c', 'src/core/lib/security/credentials/jwt/json_token.c', diff --git a/build.yaml b/build.yaml index 39514bdef0..e3afcd643b 100644 --- a/build.yaml +++ b/build.yaml @@ -466,8 +466,7 @@ filegroups: - src/core/lib/security/credentials/credentials.c - src/core/lib/security/credentials/credentials_metadata.c - src/core/lib/security/credentials/fake/fake_credentials.c - - src/core/lib/security/credentials/google_default/credentials_posix.c - - src/core/lib/security/credentials/google_default/credentials_windows.c + - src/core/lib/security/credentials/google_default/credentials_generic.c - src/core/lib/security/credentials/google_default/google_default_credentials.c - src/core/lib/security/credentials/iam/iam_credentials.c - src/core/lib/security/credentials/jwt/json_token.c diff --git a/config.m4 b/config.m4 index 69f06274d7..7a06923e59 100644 --- a/config.m4 +++ b/config.m4 @@ -201,8 +201,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/security/credentials/credentials.c \ src/core/lib/security/credentials/credentials_metadata.c \ src/core/lib/security/credentials/fake/fake_credentials.c \ - src/core/lib/security/credentials/google_default/credentials_posix.c \ - src/core/lib/security/credentials/google_default/credentials_windows.c \ + src/core/lib/security/credentials/google_default/credentials_generic.c \ src/core/lib/security/credentials/google_default/google_default_credentials.c \ src/core/lib/security/credentials/iam/iam_credentials.c \ src/core/lib/security/credentials/jwt/json_token.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 753dabebe4..b7a5e72a2a 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -533,8 +533,7 @@ Pod::Spec.new do |s| 'src/core/lib/security/credentials/credentials.c', 'src/core/lib/security/credentials/credentials_metadata.c', 'src/core/lib/security/credentials/fake/fake_credentials.c', - 'src/core/lib/security/credentials/google_default/credentials_posix.c', - 'src/core/lib/security/credentials/google_default/credentials_windows.c', + 'src/core/lib/security/credentials/google_default/credentials_generic.c', 'src/core/lib/security/credentials/google_default/google_default_credentials.c', 'src/core/lib/security/credentials/iam/iam_credentials.c', 'src/core/lib/security/credentials/jwt/json_token.c', diff --git a/grpc.gemspec b/grpc.gemspec index bb7913bf66..d231bf1db9 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -452,8 +452,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/security/credentials/credentials.c ) s.files += %w( src/core/lib/security/credentials/credentials_metadata.c ) s.files += %w( src/core/lib/security/credentials/fake/fake_credentials.c ) - s.files += %w( src/core/lib/security/credentials/google_default/credentials_posix.c ) - s.files += %w( src/core/lib/security/credentials/google_default/credentials_windows.c ) + s.files += %w( src/core/lib/security/credentials/google_default/credentials_generic.c ) s.files += %w( src/core/lib/security/credentials/google_default/google_default_credentials.c ) s.files += %w( src/core/lib/security/credentials/iam/iam_credentials.c ) s.files += %w( src/core/lib/security/credentials/jwt/json_token.c ) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index f65f56db87..c2b467a1bc 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -125,7 +125,6 @@ #define GPR_LINUX_LOG 1 #define GPR_SUPPORT_CHANNELS_FROM_FD 1 #define GPR_LINUX_ENV 1 -#define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 #define GPR_POSIX_STRING 1 #define GPR_POSIX_SUBPROCESS 1 @@ -149,7 +148,6 @@ #define GPR_GCC_SYNC 1 #define GPR_GCC_TLS 1 #define GPR_POSIX_ENV 1 -#define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 #define GPR_POSIX_LOG #define GPR_POSIX_STRING 1 @@ -181,7 +179,6 @@ #ifndef GRPC_LINUX_EVENTFD #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 #endif -#define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 #define GPR_POSIX_STRING 1 #define GPR_POSIX_SUBPROCESS 1 @@ -213,7 +210,6 @@ #define GPR_GCC_ATOMIC 1 #define GPR_POSIX_LOG 1 #define GPR_POSIX_ENV 1 -#define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 #define GPR_POSIX_STRING 1 #define GPR_POSIX_SUBPROCESS 1 @@ -237,7 +233,6 @@ #define GPR_GCC_TLS 1 #define GPR_POSIX_LOG 1 #define GPR_POSIX_ENV 1 -#define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 #define GPR_POSIX_STRING 1 #define GPR_POSIX_SUBPROCESS 1 @@ -267,7 +262,6 @@ #define GPR_GCC_TLS 1 #define GPR_POSIX_LOG 1 #define GPR_POSIX_ENV 1 -#define GPR_POSIX_FILE 1 #define GPR_POSIX_TMPFILE 1 #define GPR_POSIX_STRING 1 #define GPR_POSIX_SUBPROCESS 1 diff --git a/package.xml b/package.xml index 3d5a83dc79..dd59cfd330 100644 --- a/package.xml +++ b/package.xml @@ -460,8 +460,7 @@ - - + diff --git a/src/core/lib/security/credentials/google_default/credentials_generic.c b/src/core/lib/security/credentials/google_default/credentials_generic.c new file mode 100644 index 0000000000..02a6e9e9dd --- /dev/null +++ b/src/core/lib/security/credentials/google_default/credentials_generic.c @@ -0,0 +1,59 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/security/credentials/google_default/google_default_credentials.h" + +#ifdef GRPC_GOOGLE_CREDENTIALS_GENERIC + +#include +#include +#include + +#include "src/core/lib/support/env.h" +#include "src/core/lib/support/string.h" + +char *grpc_get_well_known_google_credentials_file_path_impl(void) { + char *result = NULL; + char *base = gpr_getenv(GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR); + if (base == NULL) { + gpr_log(GPR_ERROR, "Could not get " GRPC_GOOGLE_CREDENTIALS_ENV_VAR + " environment variable."); + return NULL; + } + gpr_asprintf(&result, "%s/%s", base, + GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX); + gpr_free(base); + return result; +} + +#endif /* GRPC_GOOGLE_CREDENTIALS_GENERIC */ diff --git a/src/core/lib/security/credentials/google_default/credentials_posix.c b/src/core/lib/security/credentials/google_default/credentials_posix.c deleted file mode 100644 index 42c9d7f997..0000000000 --- a/src/core/lib/security/credentials/google_default/credentials_posix.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#ifdef GPR_POSIX_FILE - -#include "src/core/lib/security/credentials/google_default/google_default_credentials.h" - -#include -#include -#include - -#include "src/core/lib/support/env.h" -#include "src/core/lib/support/string.h" - -char *grpc_get_well_known_google_credentials_file_path_impl(void) { - char *result = NULL; - char *home = gpr_getenv("HOME"); - if (home == NULL) { - gpr_log(GPR_ERROR, "Could not get HOME environment variable."); - return NULL; - } - gpr_asprintf(&result, "%s/.config/%s/%s", home, - GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY, - GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE); - gpr_free(home); - return result; -} - -#endif /* GPR_POSIX_FILE */ diff --git a/src/core/lib/security/credentials/google_default/credentials_windows.c b/src/core/lib/security/credentials/google_default/credentials_windows.c deleted file mode 100644 index 208b8fd9ad..0000000000 --- a/src/core/lib/security/credentials/google_default/credentials_windows.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#ifdef GPR_WINDOWS - -#include "src/core/lib/security/credentials/google_default/google_default_credentials.h" - -#include -#include -#include - -#include "src/core/lib/support/env.h" -#include "src/core/lib/support/string.h" - -char *grpc_get_well_known_google_credentials_file_path_impl(void) { - char *result = NULL; - char *appdata_path = gpr_getenv("APPDATA"); - if (appdata_path == NULL) { - gpr_log(GPR_ERROR, "Could not get APPDATA environment variable."); - return NULL; - } - gpr_asprintf(&result, "%s/%s/%s", appdata_path, - GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY, - GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE); - gpr_free(appdata_path); - return result; -} - -#endif /* GPR_WINDOWS */ diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.h b/src/core/lib/security/credentials/google_default/google_default_credentials.h index fac4377e2c..bc816bcb77 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.h +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.h @@ -34,12 +34,24 @@ #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H +#include + #include "src/core/lib/security/credentials/credentials.h" #define GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "gcloud" #define GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE \ "application_default_credentials.json" +#ifdef GPR_WINDOWS +#define GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR "APPDATA" +#define GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "/" GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE +#define GRPC_GOOGLE_CREDENTIALS_GENERIC 1 +#else +#define GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR "HOME" +#define GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX ".config/" GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "/" GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE +#define GRPC_GOOGLE_CREDENTIALS_GENERIC 1 +#endif + void grpc_flush_cached_google_default_credentials(void); #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_GOOGLE_DEFAULT_GOOGLE_DEFAULT_CREDENTIALS_H \ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 78fa428903..ab7b461178 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -195,8 +195,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/security/credentials/credentials.c', 'src/core/lib/security/credentials/credentials_metadata.c', 'src/core/lib/security/credentials/fake/fake_credentials.c', - 'src/core/lib/security/credentials/google_default/credentials_posix.c', - 'src/core/lib/security/credentials/google_default/credentials_windows.c', + 'src/core/lib/security/credentials/google_default/credentials_generic.c', 'src/core/lib/security/credentials/google_default/google_default_credentials.c', 'src/core/lib/security/credentials/iam/iam_credentials.c', 'src/core/lib/security/credentials/jwt/json_token.c', diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index 7043953154..d4dd500580 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -1124,28 +1124,20 @@ static void test_metadata_plugin_failure(void) { } static void test_get_well_known_google_credentials_file_path(void) { -#ifdef GPR_POSIX_FILE char *path; - char *old_home = gpr_getenv("HOME"); - gpr_setenv("HOME", "/tmp"); + char *home = gpr_getenv("HOME"); + char *appdata = gpr_getenv("APPDATA"); path = grpc_get_well_known_google_credentials_file_path(); GPR_ASSERT(path != NULL); - GPR_ASSERT(0 == strcmp("/tmp/.config/" GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY - "/" GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE, - path)); - gpr_free(path); -#if defined(GPR_POSIX_ENV) || defined(GPR_LINUX_ENV) unsetenv("HOME"); + unsetenv("APPDATA"); path = grpc_get_well_known_google_credentials_file_path(); GPR_ASSERT(path == NULL); -#endif /* GPR_POSIX_ENV || GPR_LINUX_ENV */ - gpr_setenv("HOME", old_home); - gpr_free(old_home); -#else /* GPR_POSIX_FILE */ - char *path = grpc_get_well_known_google_credentials_file_path(); - GPR_ASSERT(path != NULL); + gpr_setenv("HOME", home); + gpr_setenv("APPDATA", appdata); + gpr_free(home); + gpr_free(appdata); gpr_free(path); -#endif } int main(int argc, char **argv) { diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 8f2f011eaf..24c78091c7 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1071,8 +1071,7 @@ src/core/lib/security/credentials/composite/composite_credentials.c \ src/core/lib/security/credentials/credentials.c \ src/core/lib/security/credentials/credentials_metadata.c \ src/core/lib/security/credentials/fake/fake_credentials.c \ -src/core/lib/security/credentials/google_default/credentials_posix.c \ -src/core/lib/security/credentials/google_default/credentials_windows.c \ +src/core/lib/security/credentials/google_default/credentials_generic.c \ src/core/lib/security/credentials/google_default/google_default_credentials.c \ src/core/lib/security/credentials/iam/iam_credentials.c \ src/core/lib/security/credentials/jwt/json_token.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 8c1cd249ba..534abdda09 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -6275,8 +6275,7 @@ "src/core/lib/security/credentials/credentials_metadata.c", "src/core/lib/security/credentials/fake/fake_credentials.c", "src/core/lib/security/credentials/fake/fake_credentials.h", - "src/core/lib/security/credentials/google_default/credentials_posix.c", - "src/core/lib/security/credentials/google_default/credentials_windows.c", + "src/core/lib/security/credentials/google_default/credentials_generic.c", "src/core/lib/security/credentials/google_default/google_default_credentials.c", "src/core/lib/security/credentials/google_default/google_default_credentials.h", "src/core/lib/security/credentials/iam/iam_credentials.c", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 69ec3c0a08..d09c07d0cb 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -702,9 +702,7 @@ - - - + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index d72c32046a..d5ac3d4422 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -361,10 +361,7 @@ src\core\lib\security\credentials\fake - - src\core\lib\security\credentials\google_default - - + src\core\lib\security\credentials\google_default -- cgit v1.2.3 From 9030c81f20c3721e7b0a92564f6e4d772a78ffcb Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 16 Sep 2016 13:25:08 -0700 Subject: Add a libuv endpoint to the C core, for use in the Node library --- BUILD | 68 +++- CMakeLists.txt | 36 +- Makefile | 48 ++- binding.gyp | 16 +- build.yaml | 19 +- config.m4 | 12 +- gRPC-Core.podspec | 22 +- grpc.gemspec | 17 +- package.xml | 17 +- src/core/ext/client_config/client_config_plugin.c | 5 + src/core/ext/client_config/connector.h | 5 + src/core/ext/lb_policy/grpclb/grpclb.c | 5 + src/core/ext/lb_policy/pick_first/pick_first.c | 5 + src/core/ext/lb_policy/round_robin/round_robin.c | 5 + src/core/ext/resolver/dns/native/dns_resolver.c | 5 + src/core/ext/resolver/sockaddr/sockaddr_resolver.c | 5 + src/core/lib/http/httpcli.h | 5 + src/core/lib/iomgr/iomgr.h | 2 + src/core/lib/iomgr/iomgr_uv.c | 51 +++ src/core/lib/iomgr/pollset_set_uv.c | 62 ++++ src/core/lib/iomgr/pollset_set_windows.c | 2 +- src/core/lib/iomgr/pollset_uv.c | 84 +++++ src/core/lib/iomgr/pollset_uv.h | 35 ++ src/core/lib/iomgr/port.h | 13 +- src/core/lib/iomgr/resolve_address_uv.c | 234 +++++++++++++ src/core/lib/iomgr/sockaddr.h | 4 + src/core/lib/iomgr/socket_utils.h | 6 +- src/core/lib/iomgr/socket_utils_uv.c | 50 +++ src/core/lib/iomgr/tcp_client_uv.c | 142 ++++++++ src/core/lib/iomgr/tcp_server_uv.c | 358 +++++++++++++++++++ src/core/lib/iomgr/tcp_uv.c | 336 ++++++++++++++++++ src/core/lib/iomgr/tcp_uv.h | 57 +++ src/core/lib/iomgr/timer.c | 384 -------------------- src/core/lib/iomgr/timer.h | 17 +- src/core/lib/iomgr/timer_generic.c | 390 +++++++++++++++++++++ src/core/lib/iomgr/timer_generic.h | 49 +++ src/core/lib/iomgr/timer_heap.c | 6 + src/core/lib/iomgr/timer_uv.c | 103 ++++++ src/core/lib/iomgr/timer_uv.h | 47 +++ src/core/lib/iomgr/workqueue_uv.c | 62 ++++ src/core/lib/iomgr/workqueue_uv.h | 37 ++ src/core/lib/security/context/security_context.c | 5 + src/core/lib/security/context/security_context.h | 5 + src/core/lib/security/credentials/credentials.h | 5 + .../credentials/oauth2/oauth2_credentials.c | 5 + .../lib/security/transport/server_auth_filter.c | 5 + src/core/lib/surface/call.c | 6 + src/core/lib/surface/init_secure.c | 5 + src/core/lib/tsi/ssl_transport_security.c | 5 + src/node/ext/call.cc | 73 +++- src/node/ext/call.h | 68 ++-- src/node/ext/channel.cc | 8 +- src/node/ext/completion_queue.cc | 114 ++++++ src/node/ext/completion_queue.h | 46 +++ src/node/ext/completion_queue_async_worker.cc | 2 + src/node/ext/node_grpc.cc | 19 +- src/node/ext/server.cc | 91 ++++- src/node/ext/server.h | 1 - src/node/ext/server_credentials.cc | 8 +- src/node/index.js | 4 + src/node/src/client.js | 1 + src/node/src/grpc_extension.js | 2 +- src/node/test/async_test.js | 1 + src/python/grpcio/grpc_core_dependencies.py | 12 +- templates/binding.gyp.template | 3 + tools/doxygen/Doxyfile.core.internal | 17 +- tools/run_tests/performance/scenario_config.py | 15 +- tools/run_tests/sources_and_headers.json | 22 +- vsprojects/vcxproj/grpc/grpc.vcxproj | 27 +- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 47 ++- .../vcxproj/grpc_test_util/grpc_test_util.vcxproj | 27 +- .../grpc_test_util/grpc_test_util.vcxproj.filters | 47 ++- .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 27 +- .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 47 ++- 74 files changed, 3103 insertions(+), 493 deletions(-) create mode 100644 src/core/lib/iomgr/iomgr_uv.c create mode 100644 src/core/lib/iomgr/pollset_set_uv.c create mode 100644 src/core/lib/iomgr/pollset_uv.c create mode 100644 src/core/lib/iomgr/pollset_uv.h create mode 100644 src/core/lib/iomgr/resolve_address_uv.c create mode 100644 src/core/lib/iomgr/socket_utils_uv.c create mode 100644 src/core/lib/iomgr/tcp_client_uv.c create mode 100644 src/core/lib/iomgr/tcp_server_uv.c create mode 100644 src/core/lib/iomgr/tcp_uv.c create mode 100644 src/core/lib/iomgr/tcp_uv.h delete mode 100644 src/core/lib/iomgr/timer.c create mode 100644 src/core/lib/iomgr/timer_generic.c create mode 100644 src/core/lib/iomgr/timer_generic.h create mode 100644 src/core/lib/iomgr/timer_uv.c create mode 100644 src/core/lib/iomgr/timer_uv.h create mode 100644 src/core/lib/iomgr/workqueue_uv.c create mode 100644 src/core/lib/iomgr/workqueue_uv.h create mode 100644 src/node/ext/completion_queue.cc create mode 100644 src/node/ext/completion_queue.h (limited to 'tools/doxygen/Doxyfile.core.internal') diff --git a/BUILD b/BUILD index cf81163832..57f0e0d7bf 100644 --- a/BUILD +++ b/BUILD @@ -194,6 +194,7 @@ cc_library( "src/core/lib/iomgr/pollset.h", "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", + "src/core/lib/iomgr/pollset_uv.h", "src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", @@ -207,16 +208,20 @@ cc_library( "src/core/lib/iomgr/tcp_client.h", "src/core/lib/iomgr/tcp_posix.h", "src/core/lib/iomgr/tcp_server.h", + "src/core/lib/iomgr/tcp_uv.h", "src/core/lib/iomgr/tcp_windows.h", "src/core/lib/iomgr/time_averaged_stats.h", "src/core/lib/iomgr/timer.h", + "src/core/lib/iomgr/timer_generic.h", "src/core/lib/iomgr/timer_heap.h", + "src/core/lib/iomgr/timer_uv.h", "src/core/lib/iomgr/udp_server.h", "src/core/lib/iomgr/unix_sockets_posix.h", "src/core/lib/iomgr/wakeup_fd_pipe.h", "src/core/lib/iomgr/wakeup_fd_posix.h", "src/core/lib/iomgr/workqueue.h", "src/core/lib/iomgr/workqueue_posix.h", + "src/core/lib/iomgr/workqueue_uv.h", "src/core/lib/iomgr/workqueue_windows.h", "src/core/lib/json/json.h", "src/core/lib/json/json_common.h", @@ -345,29 +350,38 @@ cc_library( "src/core/lib/iomgr/iocp_windows.c", "src/core/lib/iomgr/iomgr.c", "src/core/lib/iomgr/iomgr_posix.c", + "src/core/lib/iomgr/iomgr_uv.c", "src/core/lib/iomgr/iomgr_windows.c", "src/core/lib/iomgr/load_file.c", "src/core/lib/iomgr/network_status_tracker.c", "src/core/lib/iomgr/polling_entity.c", + "src/core/lib/iomgr/pollset_set_uv.c", "src/core/lib/iomgr/pollset_set_windows.c", + "src/core/lib/iomgr/pollset_uv.c", "src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/resolve_address_posix.c", + "src/core/lib/iomgr/resolve_address_uv.c", "src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/socket_utils_common_posix.c", "src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_posix.c", + "src/core/lib/iomgr/socket_utils_uv.c", "src/core/lib/iomgr/socket_utils_windows.c", "src/core/lib/iomgr/socket_windows.c", "src/core/lib/iomgr/tcp_client_posix.c", + "src/core/lib/iomgr/tcp_client_uv.c", "src/core/lib/iomgr/tcp_client_windows.c", "src/core/lib/iomgr/tcp_posix.c", "src/core/lib/iomgr/tcp_server_posix.c", + "src/core/lib/iomgr/tcp_server_uv.c", "src/core/lib/iomgr/tcp_server_windows.c", + "src/core/lib/iomgr/tcp_uv.c", "src/core/lib/iomgr/tcp_windows.c", "src/core/lib/iomgr/time_averaged_stats.c", - "src/core/lib/iomgr/timer.c", + "src/core/lib/iomgr/timer_generic.c", "src/core/lib/iomgr/timer_heap.c", + "src/core/lib/iomgr/timer_uv.c", "src/core/lib/iomgr/udp_server.c", "src/core/lib/iomgr/unix_sockets_posix.c", "src/core/lib/iomgr/unix_sockets_posix_noop.c", @@ -376,6 +390,7 @@ cc_library( "src/core/lib/iomgr/wakeup_fd_pipe.c", "src/core/lib/iomgr/wakeup_fd_posix.c", "src/core/lib/iomgr/workqueue_posix.c", + "src/core/lib/iomgr/workqueue_uv.c", "src/core/lib/iomgr/workqueue_windows.c", "src/core/lib/json/json.c", "src/core/lib/json/json_reader.c", @@ -591,6 +606,7 @@ cc_library( "src/core/lib/iomgr/pollset.h", "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", + "src/core/lib/iomgr/pollset_uv.h", "src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", @@ -604,16 +620,20 @@ cc_library( "src/core/lib/iomgr/tcp_client.h", "src/core/lib/iomgr/tcp_posix.h", "src/core/lib/iomgr/tcp_server.h", + "src/core/lib/iomgr/tcp_uv.h", "src/core/lib/iomgr/tcp_windows.h", "src/core/lib/iomgr/time_averaged_stats.h", "src/core/lib/iomgr/timer.h", + "src/core/lib/iomgr/timer_generic.h", "src/core/lib/iomgr/timer_heap.h", + "src/core/lib/iomgr/timer_uv.h", "src/core/lib/iomgr/udp_server.h", "src/core/lib/iomgr/unix_sockets_posix.h", "src/core/lib/iomgr/wakeup_fd_pipe.h", "src/core/lib/iomgr/wakeup_fd_posix.h", "src/core/lib/iomgr/workqueue.h", "src/core/lib/iomgr/workqueue_posix.h", + "src/core/lib/iomgr/workqueue_uv.h", "src/core/lib/iomgr/workqueue_windows.h", "src/core/lib/json/json.h", "src/core/lib/json/json_common.h", @@ -729,29 +749,38 @@ cc_library( "src/core/lib/iomgr/iocp_windows.c", "src/core/lib/iomgr/iomgr.c", "src/core/lib/iomgr/iomgr_posix.c", + "src/core/lib/iomgr/iomgr_uv.c", "src/core/lib/iomgr/iomgr_windows.c", "src/core/lib/iomgr/load_file.c", "src/core/lib/iomgr/network_status_tracker.c", "src/core/lib/iomgr/polling_entity.c", + "src/core/lib/iomgr/pollset_set_uv.c", "src/core/lib/iomgr/pollset_set_windows.c", + "src/core/lib/iomgr/pollset_uv.c", "src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/resolve_address_posix.c", + "src/core/lib/iomgr/resolve_address_uv.c", "src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/socket_utils_common_posix.c", "src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_posix.c", + "src/core/lib/iomgr/socket_utils_uv.c", "src/core/lib/iomgr/socket_utils_windows.c", "src/core/lib/iomgr/socket_windows.c", "src/core/lib/iomgr/tcp_client_posix.c", + "src/core/lib/iomgr/tcp_client_uv.c", "src/core/lib/iomgr/tcp_client_windows.c", "src/core/lib/iomgr/tcp_posix.c", "src/core/lib/iomgr/tcp_server_posix.c", + "src/core/lib/iomgr/tcp_server_uv.c", "src/core/lib/iomgr/tcp_server_windows.c", + "src/core/lib/iomgr/tcp_uv.c", "src/core/lib/iomgr/tcp_windows.c", "src/core/lib/iomgr/time_averaged_stats.c", - "src/core/lib/iomgr/timer.c", + "src/core/lib/iomgr/timer_generic.c", "src/core/lib/iomgr/timer_heap.c", + "src/core/lib/iomgr/timer_uv.c", "src/core/lib/iomgr/udp_server.c", "src/core/lib/iomgr/unix_sockets_posix.c", "src/core/lib/iomgr/unix_sockets_posix_noop.c", @@ -760,6 +789,7 @@ cc_library( "src/core/lib/iomgr/wakeup_fd_pipe.c", "src/core/lib/iomgr/wakeup_fd_posix.c", "src/core/lib/iomgr/workqueue_posix.c", + "src/core/lib/iomgr/workqueue_uv.c", "src/core/lib/iomgr/workqueue_windows.c", "src/core/lib/json/json.c", "src/core/lib/json/json_reader.c", @@ -947,6 +977,7 @@ cc_library( "src/core/lib/iomgr/pollset.h", "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", + "src/core/lib/iomgr/pollset_uv.h", "src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", @@ -960,16 +991,20 @@ cc_library( "src/core/lib/iomgr/tcp_client.h", "src/core/lib/iomgr/tcp_posix.h", "src/core/lib/iomgr/tcp_server.h", + "src/core/lib/iomgr/tcp_uv.h", "src/core/lib/iomgr/tcp_windows.h", "src/core/lib/iomgr/time_averaged_stats.h", "src/core/lib/iomgr/timer.h", + "src/core/lib/iomgr/timer_generic.h", "src/core/lib/iomgr/timer_heap.h", + "src/core/lib/iomgr/timer_uv.h", "src/core/lib/iomgr/udp_server.h", "src/core/lib/iomgr/unix_sockets_posix.h", "src/core/lib/iomgr/wakeup_fd_pipe.h", "src/core/lib/iomgr/wakeup_fd_posix.h", "src/core/lib/iomgr/workqueue.h", "src/core/lib/iomgr/workqueue_posix.h", + "src/core/lib/iomgr/workqueue_uv.h", "src/core/lib/iomgr/workqueue_windows.h", "src/core/lib/json/json.h", "src/core/lib/json/json_common.h", @@ -1075,29 +1110,38 @@ cc_library( "src/core/lib/iomgr/iocp_windows.c", "src/core/lib/iomgr/iomgr.c", "src/core/lib/iomgr/iomgr_posix.c", + "src/core/lib/iomgr/iomgr_uv.c", "src/core/lib/iomgr/iomgr_windows.c", "src/core/lib/iomgr/load_file.c", "src/core/lib/iomgr/network_status_tracker.c", "src/core/lib/iomgr/polling_entity.c", + "src/core/lib/iomgr/pollset_set_uv.c", "src/core/lib/iomgr/pollset_set_windows.c", + "src/core/lib/iomgr/pollset_uv.c", "src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/resolve_address_posix.c", + "src/core/lib/iomgr/resolve_address_uv.c", "src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/socket_utils_common_posix.c", "src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_posix.c", + "src/core/lib/iomgr/socket_utils_uv.c", "src/core/lib/iomgr/socket_utils_windows.c", "src/core/lib/iomgr/socket_windows.c", "src/core/lib/iomgr/tcp_client_posix.c", + "src/core/lib/iomgr/tcp_client_uv.c", "src/core/lib/iomgr/tcp_client_windows.c", "src/core/lib/iomgr/tcp_posix.c", "src/core/lib/iomgr/tcp_server_posix.c", + "src/core/lib/iomgr/tcp_server_uv.c", "src/core/lib/iomgr/tcp_server_windows.c", + "src/core/lib/iomgr/tcp_uv.c", "src/core/lib/iomgr/tcp_windows.c", "src/core/lib/iomgr/time_averaged_stats.c", - "src/core/lib/iomgr/timer.c", + "src/core/lib/iomgr/timer_generic.c", "src/core/lib/iomgr/timer_heap.c", + "src/core/lib/iomgr/timer_uv.c", "src/core/lib/iomgr/udp_server.c", "src/core/lib/iomgr/unix_sockets_posix.c", "src/core/lib/iomgr/unix_sockets_posix_noop.c", @@ -1106,6 +1150,7 @@ cc_library( "src/core/lib/iomgr/wakeup_fd_pipe.c", "src/core/lib/iomgr/wakeup_fd_posix.c", "src/core/lib/iomgr/workqueue_posix.c", + "src/core/lib/iomgr/workqueue_uv.c", "src/core/lib/iomgr/workqueue_windows.c", "src/core/lib/json/json.c", "src/core/lib/json/json_reader.c", @@ -1843,29 +1888,38 @@ objc_library( "src/core/lib/iomgr/iocp_windows.c", "src/core/lib/iomgr/iomgr.c", "src/core/lib/iomgr/iomgr_posix.c", + "src/core/lib/iomgr/iomgr_uv.c", "src/core/lib/iomgr/iomgr_windows.c", "src/core/lib/iomgr/load_file.c", "src/core/lib/iomgr/network_status_tracker.c", "src/core/lib/iomgr/polling_entity.c", + "src/core/lib/iomgr/pollset_set_uv.c", "src/core/lib/iomgr/pollset_set_windows.c", + "src/core/lib/iomgr/pollset_uv.c", "src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/resolve_address_posix.c", + "src/core/lib/iomgr/resolve_address_uv.c", "src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/socket_utils_common_posix.c", "src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_posix.c", + "src/core/lib/iomgr/socket_utils_uv.c", "src/core/lib/iomgr/socket_utils_windows.c", "src/core/lib/iomgr/socket_windows.c", "src/core/lib/iomgr/tcp_client_posix.c", + "src/core/lib/iomgr/tcp_client_uv.c", "src/core/lib/iomgr/tcp_client_windows.c", "src/core/lib/iomgr/tcp_posix.c", "src/core/lib/iomgr/tcp_server_posix.c", + "src/core/lib/iomgr/tcp_server_uv.c", "src/core/lib/iomgr/tcp_server_windows.c", + "src/core/lib/iomgr/tcp_uv.c", "src/core/lib/iomgr/tcp_windows.c", "src/core/lib/iomgr/time_averaged_stats.c", - "src/core/lib/iomgr/timer.c", + "src/core/lib/iomgr/timer_generic.c", "src/core/lib/iomgr/timer_heap.c", + "src/core/lib/iomgr/timer_uv.c", "src/core/lib/iomgr/udp_server.c", "src/core/lib/iomgr/unix_sockets_posix.c", "src/core/lib/iomgr/unix_sockets_posix_noop.c", @@ -1874,6 +1928,7 @@ objc_library( "src/core/lib/iomgr/wakeup_fd_pipe.c", "src/core/lib/iomgr/wakeup_fd_posix.c", "src/core/lib/iomgr/workqueue_posix.c", + "src/core/lib/iomgr/workqueue_uv.c", "src/core/lib/iomgr/workqueue_windows.c", "src/core/lib/json/json.c", "src/core/lib/json/json_reader.c", @@ -2068,6 +2123,7 @@ objc_library( "src/core/lib/iomgr/pollset.h", "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", + "src/core/lib/iomgr/pollset_uv.h", "src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", @@ -2081,16 +2137,20 @@ objc_library( "src/core/lib/iomgr/tcp_client.h", "src/core/lib/iomgr/tcp_posix.h", "src/core/lib/iomgr/tcp_server.h", + "src/core/lib/iomgr/tcp_uv.h", "src/core/lib/iomgr/tcp_windows.h", "src/core/lib/iomgr/time_averaged_stats.h", "src/core/lib/iomgr/timer.h", + "src/core/lib/iomgr/timer_generic.h", "src/core/lib/iomgr/timer_heap.h", + "src/core/lib/iomgr/timer_uv.h", "src/core/lib/iomgr/udp_server.h", "src/core/lib/iomgr/unix_sockets_posix.h", "src/core/lib/iomgr/wakeup_fd_pipe.h", "src/core/lib/iomgr/wakeup_fd_posix.h", "src/core/lib/iomgr/workqueue.h", "src/core/lib/iomgr/workqueue_posix.h", + "src/core/lib/iomgr/workqueue_uv.h", "src/core/lib/iomgr/workqueue_windows.h", "src/core/lib/json/json.h", "src/core/lib/json/json_common.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ba714465e..722051e749 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,29 +319,38 @@ add_library(grpc src/core/lib/iomgr/iocp_windows.c src/core/lib/iomgr/iomgr.c src/core/lib/iomgr/iomgr_posix.c + src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c + src/core/lib/iomgr/pollset_set_uv.c src/core/lib/iomgr/pollset_set_windows.c + src/core/lib/iomgr/pollset_uv.c src/core/lib/iomgr/pollset_windows.c src/core/lib/iomgr/resolve_address_posix.c + src/core/lib/iomgr/resolve_address_uv.c src/core/lib/iomgr/resolve_address_windows.c src/core/lib/iomgr/sockaddr_utils.c src/core/lib/iomgr/socket_utils_common_posix.c src/core/lib/iomgr/socket_utils_linux.c src/core/lib/iomgr/socket_utils_posix.c + src/core/lib/iomgr/socket_utils_uv.c src/core/lib/iomgr/socket_utils_windows.c src/core/lib/iomgr/socket_windows.c src/core/lib/iomgr/tcp_client_posix.c + src/core/lib/iomgr/tcp_client_uv.c src/core/lib/iomgr/tcp_client_windows.c src/core/lib/iomgr/tcp_posix.c src/core/lib/iomgr/tcp_server_posix.c + src/core/lib/iomgr/tcp_server_uv.c src/core/lib/iomgr/tcp_server_windows.c + src/core/lib/iomgr/tcp_uv.c src/core/lib/iomgr/tcp_windows.c src/core/lib/iomgr/time_averaged_stats.c - src/core/lib/iomgr/timer.c + src/core/lib/iomgr/timer_generic.c src/core/lib/iomgr/timer_heap.c + src/core/lib/iomgr/timer_uv.c src/core/lib/iomgr/udp_server.c src/core/lib/iomgr/unix_sockets_posix.c src/core/lib/iomgr/unix_sockets_posix_noop.c @@ -350,6 +359,7 @@ add_library(grpc src/core/lib/iomgr/wakeup_fd_pipe.c src/core/lib/iomgr/wakeup_fd_posix.c src/core/lib/iomgr/workqueue_posix.c + src/core/lib/iomgr/workqueue_uv.c src/core/lib/iomgr/workqueue_windows.c src/core/lib/json/json.c src/core/lib/json/json_reader.c @@ -577,29 +587,38 @@ add_library(grpc_cronet src/core/lib/iomgr/iocp_windows.c src/core/lib/iomgr/iomgr.c src/core/lib/iomgr/iomgr_posix.c + src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c + src/core/lib/iomgr/pollset_set_uv.c src/core/lib/iomgr/pollset_set_windows.c + src/core/lib/iomgr/pollset_uv.c src/core/lib/iomgr/pollset_windows.c src/core/lib/iomgr/resolve_address_posix.c + src/core/lib/iomgr/resolve_address_uv.c src/core/lib/iomgr/resolve_address_windows.c src/core/lib/iomgr/sockaddr_utils.c src/core/lib/iomgr/socket_utils_common_posix.c src/core/lib/iomgr/socket_utils_linux.c src/core/lib/iomgr/socket_utils_posix.c + src/core/lib/iomgr/socket_utils_uv.c src/core/lib/iomgr/socket_utils_windows.c src/core/lib/iomgr/socket_windows.c src/core/lib/iomgr/tcp_client_posix.c + src/core/lib/iomgr/tcp_client_uv.c src/core/lib/iomgr/tcp_client_windows.c src/core/lib/iomgr/tcp_posix.c src/core/lib/iomgr/tcp_server_posix.c + src/core/lib/iomgr/tcp_server_uv.c src/core/lib/iomgr/tcp_server_windows.c + src/core/lib/iomgr/tcp_uv.c src/core/lib/iomgr/tcp_windows.c src/core/lib/iomgr/time_averaged_stats.c - src/core/lib/iomgr/timer.c + src/core/lib/iomgr/timer_generic.c src/core/lib/iomgr/timer_heap.c + src/core/lib/iomgr/timer_uv.c src/core/lib/iomgr/udp_server.c src/core/lib/iomgr/unix_sockets_posix.c src/core/lib/iomgr/unix_sockets_posix_noop.c @@ -608,6 +627,7 @@ add_library(grpc_cronet src/core/lib/iomgr/wakeup_fd_pipe.c src/core/lib/iomgr/wakeup_fd_posix.c src/core/lib/iomgr/workqueue_posix.c + src/core/lib/iomgr/workqueue_uv.c src/core/lib/iomgr/workqueue_windows.c src/core/lib/json/json.c src/core/lib/json/json_reader.c @@ -809,29 +829,38 @@ add_library(grpc_unsecure src/core/lib/iomgr/iocp_windows.c src/core/lib/iomgr/iomgr.c src/core/lib/iomgr/iomgr_posix.c + src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c + src/core/lib/iomgr/pollset_set_uv.c src/core/lib/iomgr/pollset_set_windows.c + src/core/lib/iomgr/pollset_uv.c src/core/lib/iomgr/pollset_windows.c src/core/lib/iomgr/resolve_address_posix.c + src/core/lib/iomgr/resolve_address_uv.c src/core/lib/iomgr/resolve_address_windows.c src/core/lib/iomgr/sockaddr_utils.c src/core/lib/iomgr/socket_utils_common_posix.c src/core/lib/iomgr/socket_utils_linux.c src/core/lib/iomgr/socket_utils_posix.c + src/core/lib/iomgr/socket_utils_uv.c src/core/lib/iomgr/socket_utils_windows.c src/core/lib/iomgr/socket_windows.c src/core/lib/iomgr/tcp_client_posix.c + src/core/lib/iomgr/tcp_client_uv.c src/core/lib/iomgr/tcp_client_windows.c src/core/lib/iomgr/tcp_posix.c src/core/lib/iomgr/tcp_server_posix.c + src/core/lib/iomgr/tcp_server_uv.c src/core/lib/iomgr/tcp_server_windows.c + src/core/lib/iomgr/tcp_uv.c src/core/lib/iomgr/tcp_windows.c src/core/lib/iomgr/time_averaged_stats.c - src/core/lib/iomgr/timer.c + src/core/lib/iomgr/timer_generic.c src/core/lib/iomgr/timer_heap.c + src/core/lib/iomgr/timer_uv.c src/core/lib/iomgr/udp_server.c src/core/lib/iomgr/unix_sockets_posix.c src/core/lib/iomgr/unix_sockets_posix_noop.c @@ -840,6 +869,7 @@ add_library(grpc_unsecure src/core/lib/iomgr/wakeup_fd_pipe.c src/core/lib/iomgr/wakeup_fd_posix.c src/core/lib/iomgr/workqueue_posix.c + src/core/lib/iomgr/workqueue_uv.c src/core/lib/iomgr/workqueue_windows.c src/core/lib/json/json.c src/core/lib/json/json_reader.c diff --git a/Makefile b/Makefile index c87c35962a..4abce94e51 100644 --- a/Makefile +++ b/Makefile @@ -2535,29 +2535,38 @@ LIBGRPC_SRC = \ src/core/lib/iomgr/iocp_windows.c \ src/core/lib/iomgr/iomgr.c \ src/core/lib/iomgr/iomgr_posix.c \ + src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ + src/core/lib/iomgr/pollset_set_uv.c \ src/core/lib/iomgr/pollset_set_windows.c \ + src/core/lib/iomgr/pollset_uv.c \ src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/resolve_address_posix.c \ + src/core/lib/iomgr/resolve_address_uv.c \ src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_posix.c \ + src/core/lib/iomgr/socket_utils_uv.c \ src/core/lib/iomgr/socket_utils_windows.c \ src/core/lib/iomgr/socket_windows.c \ src/core/lib/iomgr/tcp_client_posix.c \ + src/core/lib/iomgr/tcp_client_uv.c \ src/core/lib/iomgr/tcp_client_windows.c \ src/core/lib/iomgr/tcp_posix.c \ src/core/lib/iomgr/tcp_server_posix.c \ + src/core/lib/iomgr/tcp_server_uv.c \ src/core/lib/iomgr/tcp_server_windows.c \ + src/core/lib/iomgr/tcp_uv.c \ src/core/lib/iomgr/tcp_windows.c \ src/core/lib/iomgr/time_averaged_stats.c \ - src/core/lib/iomgr/timer.c \ + src/core/lib/iomgr/timer_generic.c \ src/core/lib/iomgr/timer_heap.c \ + src/core/lib/iomgr/timer_uv.c \ src/core/lib/iomgr/udp_server.c \ src/core/lib/iomgr/unix_sockets_posix.c \ src/core/lib/iomgr/unix_sockets_posix_noop.c \ @@ -2566,6 +2575,7 @@ LIBGRPC_SRC = \ src/core/lib/iomgr/wakeup_fd_pipe.c \ src/core/lib/iomgr/wakeup_fd_posix.c \ src/core/lib/iomgr/workqueue_posix.c \ + src/core/lib/iomgr/workqueue_uv.c \ src/core/lib/iomgr/workqueue_windows.c \ src/core/lib/json/json.c \ src/core/lib/json/json_reader.c \ @@ -2811,29 +2821,38 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/iomgr/iocp_windows.c \ src/core/lib/iomgr/iomgr.c \ src/core/lib/iomgr/iomgr_posix.c \ + src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ + src/core/lib/iomgr/pollset_set_uv.c \ src/core/lib/iomgr/pollset_set_windows.c \ + src/core/lib/iomgr/pollset_uv.c \ src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/resolve_address_posix.c \ + src/core/lib/iomgr/resolve_address_uv.c \ src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_posix.c \ + src/core/lib/iomgr/socket_utils_uv.c \ src/core/lib/iomgr/socket_utils_windows.c \ src/core/lib/iomgr/socket_windows.c \ src/core/lib/iomgr/tcp_client_posix.c \ + src/core/lib/iomgr/tcp_client_uv.c \ src/core/lib/iomgr/tcp_client_windows.c \ src/core/lib/iomgr/tcp_posix.c \ src/core/lib/iomgr/tcp_server_posix.c \ + src/core/lib/iomgr/tcp_server_uv.c \ src/core/lib/iomgr/tcp_server_windows.c \ + src/core/lib/iomgr/tcp_uv.c \ src/core/lib/iomgr/tcp_windows.c \ src/core/lib/iomgr/time_averaged_stats.c \ - src/core/lib/iomgr/timer.c \ + src/core/lib/iomgr/timer_generic.c \ src/core/lib/iomgr/timer_heap.c \ + src/core/lib/iomgr/timer_uv.c \ src/core/lib/iomgr/udp_server.c \ src/core/lib/iomgr/unix_sockets_posix.c \ src/core/lib/iomgr/unix_sockets_posix_noop.c \ @@ -2842,6 +2861,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/iomgr/wakeup_fd_pipe.c \ src/core/lib/iomgr/wakeup_fd_posix.c \ src/core/lib/iomgr/workqueue_posix.c \ + src/core/lib/iomgr/workqueue_uv.c \ src/core/lib/iomgr/workqueue_windows.c \ src/core/lib/json/json.c \ src/core/lib/json/json_reader.c \ @@ -3077,29 +3097,38 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/iomgr/iocp_windows.c \ src/core/lib/iomgr/iomgr.c \ src/core/lib/iomgr/iomgr_posix.c \ + src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ + src/core/lib/iomgr/pollset_set_uv.c \ src/core/lib/iomgr/pollset_set_windows.c \ + src/core/lib/iomgr/pollset_uv.c \ src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/resolve_address_posix.c \ + src/core/lib/iomgr/resolve_address_uv.c \ src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_posix.c \ + src/core/lib/iomgr/socket_utils_uv.c \ src/core/lib/iomgr/socket_utils_windows.c \ src/core/lib/iomgr/socket_windows.c \ src/core/lib/iomgr/tcp_client_posix.c \ + src/core/lib/iomgr/tcp_client_uv.c \ src/core/lib/iomgr/tcp_client_windows.c \ src/core/lib/iomgr/tcp_posix.c \ src/core/lib/iomgr/tcp_server_posix.c \ + src/core/lib/iomgr/tcp_server_uv.c \ src/core/lib/iomgr/tcp_server_windows.c \ + src/core/lib/iomgr/tcp_uv.c \ src/core/lib/iomgr/tcp_windows.c \ src/core/lib/iomgr/time_averaged_stats.c \ - src/core/lib/iomgr/timer.c \ + src/core/lib/iomgr/timer_generic.c \ src/core/lib/iomgr/timer_heap.c \ + src/core/lib/iomgr/timer_uv.c \ src/core/lib/iomgr/udp_server.c \ src/core/lib/iomgr/unix_sockets_posix.c \ src/core/lib/iomgr/unix_sockets_posix_noop.c \ @@ -3108,6 +3137,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/iomgr/wakeup_fd_pipe.c \ src/core/lib/iomgr/wakeup_fd_posix.c \ src/core/lib/iomgr/workqueue_posix.c \ + src/core/lib/iomgr/workqueue_uv.c \ src/core/lib/iomgr/workqueue_windows.c \ src/core/lib/json/json.c \ src/core/lib/json/json_reader.c \ @@ -3270,29 +3300,38 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/iomgr/iocp_windows.c \ src/core/lib/iomgr/iomgr.c \ src/core/lib/iomgr/iomgr_posix.c \ + src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ + src/core/lib/iomgr/pollset_set_uv.c \ src/core/lib/iomgr/pollset_set_windows.c \ + src/core/lib/iomgr/pollset_uv.c \ src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/resolve_address_posix.c \ + src/core/lib/iomgr/resolve_address_uv.c \ src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_posix.c \ + src/core/lib/iomgr/socket_utils_uv.c \ src/core/lib/iomgr/socket_utils_windows.c \ src/core/lib/iomgr/socket_windows.c \ src/core/lib/iomgr/tcp_client_posix.c \ + src/core/lib/iomgr/tcp_client_uv.c \ src/core/lib/iomgr/tcp_client_windows.c \ src/core/lib/iomgr/tcp_posix.c \ src/core/lib/iomgr/tcp_server_posix.c \ + src/core/lib/iomgr/tcp_server_uv.c \ src/core/lib/iomgr/tcp_server_windows.c \ + src/core/lib/iomgr/tcp_uv.c \ src/core/lib/iomgr/tcp_windows.c \ src/core/lib/iomgr/time_averaged_stats.c \ - src/core/lib/iomgr/timer.c \ + src/core/lib/iomgr/timer_generic.c \ src/core/lib/iomgr/timer_heap.c \ + src/core/lib/iomgr/timer_uv.c \ src/core/lib/iomgr/udp_server.c \ src/core/lib/iomgr/unix_sockets_posix.c \ src/core/lib/iomgr/unix_sockets_posix_noop.c \ @@ -3301,6 +3340,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/iomgr/wakeup_fd_pipe.c \ src/core/lib/iomgr/wakeup_fd_posix.c \ src/core/lib/iomgr/workqueue_posix.c \ + src/core/lib/iomgr/workqueue_uv.c \ src/core/lib/iomgr/workqueue_windows.c \ src/core/lib/json/json.c \ src/core/lib/json/json_reader.c \ diff --git a/binding.gyp b/binding.gyp index b03da7cb58..ea585464c3 100644 --- a/binding.gyp +++ b/binding.gyp @@ -42,6 +42,9 @@ '.', 'include' ], + 'defines': [ + 'GRPC_UV' + ], 'conditions': [ ['OS == "win"', { "include_dirs": [ @@ -591,29 +594,38 @@ 'src/core/lib/iomgr/iocp_windows.c', 'src/core/lib/iomgr/iomgr.c', 'src/core/lib/iomgr/iomgr_posix.c', + 'src/core/lib/iomgr/iomgr_uv.c', 'src/core/lib/iomgr/iomgr_windows.c', 'src/core/lib/iomgr/load_file.c', 'src/core/lib/iomgr/network_status_tracker.c', 'src/core/lib/iomgr/polling_entity.c', + 'src/core/lib/iomgr/pollset_set_uv.c', 'src/core/lib/iomgr/pollset_set_windows.c', + 'src/core/lib/iomgr/pollset_uv.c', 'src/core/lib/iomgr/pollset_windows.c', 'src/core/lib/iomgr/resolve_address_posix.c', + 'src/core/lib/iomgr/resolve_address_uv.c', 'src/core/lib/iomgr/resolve_address_windows.c', 'src/core/lib/iomgr/sockaddr_utils.c', 'src/core/lib/iomgr/socket_utils_common_posix.c', 'src/core/lib/iomgr/socket_utils_linux.c', 'src/core/lib/iomgr/socket_utils_posix.c', + 'src/core/lib/iomgr/socket_utils_uv.c', 'src/core/lib/iomgr/socket_utils_windows.c', 'src/core/lib/iomgr/socket_windows.c', 'src/core/lib/iomgr/tcp_client_posix.c', + 'src/core/lib/iomgr/tcp_client_uv.c', 'src/core/lib/iomgr/tcp_client_windows.c', 'src/core/lib/iomgr/tcp_posix.c', 'src/core/lib/iomgr/tcp_server_posix.c', + 'src/core/lib/iomgr/tcp_server_uv.c', 'src/core/lib/iomgr/tcp_server_windows.c', + 'src/core/lib/iomgr/tcp_uv.c', 'src/core/lib/iomgr/tcp_windows.c', 'src/core/lib/iomgr/time_averaged_stats.c', - 'src/core/lib/iomgr/timer.c', + 'src/core/lib/iomgr/timer_generic.c', 'src/core/lib/iomgr/timer_heap.c', + 'src/core/lib/iomgr/timer_uv.c', 'src/core/lib/iomgr/udp_server.c', 'src/core/lib/iomgr/unix_sockets_posix.c', 'src/core/lib/iomgr/unix_sockets_posix_noop.c', @@ -622,6 +634,7 @@ 'src/core/lib/iomgr/wakeup_fd_pipe.c', 'src/core/lib/iomgr/wakeup_fd_posix.c', 'src/core/lib/iomgr/workqueue_posix.c', + 'src/core/lib/iomgr/workqueue_uv.c', 'src/core/lib/iomgr/workqueue_windows.c', 'src/core/lib/json/json.c', 'src/core/lib/json/json_reader.c', @@ -806,6 +819,7 @@ "src/node/ext/call_credentials.cc", "src/node/ext/channel.cc", "src/node/ext/channel_credentials.cc", + "src/node/ext/completion_queue.cc", "src/node/ext/completion_queue_async_worker.cc", "src/node/ext/node_grpc.cc", "src/node/ext/server.cc", diff --git a/build.yaml b/build.yaml index e1e3a8c0bb..562dff1565 100644 --- a/build.yaml +++ b/build.yaml @@ -189,6 +189,7 @@ filegroups: - src/core/lib/iomgr/pollset.h - src/core/lib/iomgr/pollset_set.h - src/core/lib/iomgr/pollset_set_windows.h + - src/core/lib/iomgr/pollset_uv.h - src/core/lib/iomgr/pollset_windows.h - src/core/lib/iomgr/port.h - src/core/lib/iomgr/resolve_address.h @@ -202,16 +203,20 @@ filegroups: - src/core/lib/iomgr/tcp_client.h - src/core/lib/iomgr/tcp_posix.h - src/core/lib/iomgr/tcp_server.h + - src/core/lib/iomgr/tcp_uv.h - src/core/lib/iomgr/tcp_windows.h - src/core/lib/iomgr/time_averaged_stats.h - src/core/lib/iomgr/timer.h + - src/core/lib/iomgr/timer_generic.h - src/core/lib/iomgr/timer_heap.h + - src/core/lib/iomgr/timer_uv.h - src/core/lib/iomgr/udp_server.h - src/core/lib/iomgr/unix_sockets_posix.h - src/core/lib/iomgr/wakeup_fd_pipe.h - src/core/lib/iomgr/wakeup_fd_posix.h - src/core/lib/iomgr/workqueue.h - src/core/lib/iomgr/workqueue_posix.h + - src/core/lib/iomgr/workqueue_uv.h - src/core/lib/iomgr/workqueue_windows.h - src/core/lib/json/json.h - src/core/lib/json/json_common.h @@ -265,29 +270,38 @@ filegroups: - src/core/lib/iomgr/iocp_windows.c - src/core/lib/iomgr/iomgr.c - src/core/lib/iomgr/iomgr_posix.c + - src/core/lib/iomgr/iomgr_uv.c - src/core/lib/iomgr/iomgr_windows.c - src/core/lib/iomgr/load_file.c - src/core/lib/iomgr/network_status_tracker.c - src/core/lib/iomgr/polling_entity.c + - src/core/lib/iomgr/pollset_set_uv.c - src/core/lib/iomgr/pollset_set_windows.c + - src/core/lib/iomgr/pollset_uv.c - src/core/lib/iomgr/pollset_windows.c - src/core/lib/iomgr/resolve_address_posix.c + - src/core/lib/iomgr/resolve_address_uv.c - src/core/lib/iomgr/resolve_address_windows.c - src/core/lib/iomgr/sockaddr_utils.c - src/core/lib/iomgr/socket_utils_common_posix.c - src/core/lib/iomgr/socket_utils_linux.c - src/core/lib/iomgr/socket_utils_posix.c + - src/core/lib/iomgr/socket_utils_uv.c - src/core/lib/iomgr/socket_utils_windows.c - src/core/lib/iomgr/socket_windows.c - src/core/lib/iomgr/tcp_client_posix.c + - src/core/lib/iomgr/tcp_client_uv.c - src/core/lib/iomgr/tcp_client_windows.c - src/core/lib/iomgr/tcp_posix.c - src/core/lib/iomgr/tcp_server_posix.c + - src/core/lib/iomgr/tcp_server_uv.c - src/core/lib/iomgr/tcp_server_windows.c + - src/core/lib/iomgr/tcp_uv.c - src/core/lib/iomgr/tcp_windows.c - src/core/lib/iomgr/time_averaged_stats.c - - src/core/lib/iomgr/timer.c + - src/core/lib/iomgr/timer_generic.c - src/core/lib/iomgr/timer_heap.c + - src/core/lib/iomgr/timer_uv.c - src/core/lib/iomgr/udp_server.c - src/core/lib/iomgr/unix_sockets_posix.c - src/core/lib/iomgr/unix_sockets_posix_noop.c @@ -296,6 +310,7 @@ filegroups: - src/core/lib/iomgr/wakeup_fd_pipe.c - src/core/lib/iomgr/wakeup_fd_posix.c - src/core/lib/iomgr/workqueue_posix.c + - src/core/lib/iomgr/workqueue_uv.c - src/core/lib/iomgr/workqueue_windows.c - src/core/lib/json/json.c - src/core/lib/json/json_reader.c @@ -3421,6 +3436,7 @@ node_modules: - src/node/ext/call_credentials.h - src/node/ext/channel.h - src/node/ext/channel_credentials.h + - src/node/ext/completion_queue.h - src/node/ext/completion_queue_async_worker.h - src/node/ext/server.h - src/node/ext/server_credentials.h @@ -3440,6 +3456,7 @@ node_modules: - src/node/ext/call_credentials.cc - src/node/ext/channel.cc - src/node/ext/channel_credentials.cc + - src/node/ext/completion_queue.cc - src/node/ext/completion_queue_async_worker.cc - src/node/ext/node_grpc.cc - src/node/ext/server.cc diff --git a/config.m4 b/config.m4 index 7a06923e59..4df7b1a8dc 100644 --- a/config.m4 +++ b/config.m4 @@ -110,29 +110,38 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/iomgr/iocp_windows.c \ src/core/lib/iomgr/iomgr.c \ src/core/lib/iomgr/iomgr_posix.c \ + src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ + src/core/lib/iomgr/pollset_set_uv.c \ src/core/lib/iomgr/pollset_set_windows.c \ + src/core/lib/iomgr/pollset_uv.c \ src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/resolve_address_posix.c \ + src/core/lib/iomgr/resolve_address_uv.c \ src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_posix.c \ + src/core/lib/iomgr/socket_utils_uv.c \ src/core/lib/iomgr/socket_utils_windows.c \ src/core/lib/iomgr/socket_windows.c \ src/core/lib/iomgr/tcp_client_posix.c \ + src/core/lib/iomgr/tcp_client_uv.c \ src/core/lib/iomgr/tcp_client_windows.c \ src/core/lib/iomgr/tcp_posix.c \ src/core/lib/iomgr/tcp_server_posix.c \ + src/core/lib/iomgr/tcp_server_uv.c \ src/core/lib/iomgr/tcp_server_windows.c \ + src/core/lib/iomgr/tcp_uv.c \ src/core/lib/iomgr/tcp_windows.c \ src/core/lib/iomgr/time_averaged_stats.c \ - src/core/lib/iomgr/timer.c \ + src/core/lib/iomgr/timer_generic.c \ src/core/lib/iomgr/timer_heap.c \ + src/core/lib/iomgr/timer_uv.c \ src/core/lib/iomgr/udp_server.c \ src/core/lib/iomgr/unix_sockets_posix.c \ src/core/lib/iomgr/unix_sockets_posix_noop.c \ @@ -141,6 +150,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/iomgr/wakeup_fd_pipe.c \ src/core/lib/iomgr/wakeup_fd_posix.c \ src/core/lib/iomgr/workqueue_posix.c \ + src/core/lib/iomgr/workqueue_uv.c \ src/core/lib/iomgr/workqueue_windows.c \ src/core/lib/json/json.c \ src/core/lib/json/json_reader.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index b7a5e72a2a..f11fc5c6c5 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -287,6 +287,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/pollset.h', 'src/core/lib/iomgr/pollset_set.h', 'src/core/lib/iomgr/pollset_set_windows.h', + 'src/core/lib/iomgr/pollset_uv.h', 'src/core/lib/iomgr/pollset_windows.h', 'src/core/lib/iomgr/port.h', 'src/core/lib/iomgr/resolve_address.h', @@ -300,16 +301,20 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/tcp_client.h', 'src/core/lib/iomgr/tcp_posix.h', 'src/core/lib/iomgr/tcp_server.h', + 'src/core/lib/iomgr/tcp_uv.h', 'src/core/lib/iomgr/tcp_windows.h', 'src/core/lib/iomgr/time_averaged_stats.h', 'src/core/lib/iomgr/timer.h', + 'src/core/lib/iomgr/timer_generic.h', 'src/core/lib/iomgr/timer_heap.h', + 'src/core/lib/iomgr/timer_uv.h', 'src/core/lib/iomgr/udp_server.h', 'src/core/lib/iomgr/unix_sockets_posix.h', 'src/core/lib/iomgr/wakeup_fd_pipe.h', 'src/core/lib/iomgr/wakeup_fd_posix.h', 'src/core/lib/iomgr/workqueue.h', 'src/core/lib/iomgr/workqueue_posix.h', + 'src/core/lib/iomgr/workqueue_uv.h', 'src/core/lib/iomgr/workqueue_windows.h', 'src/core/lib/json/json.h', 'src/core/lib/json/json_common.h', @@ -442,29 +447,38 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/iocp_windows.c', 'src/core/lib/iomgr/iomgr.c', 'src/core/lib/iomgr/iomgr_posix.c', + 'src/core/lib/iomgr/iomgr_uv.c', 'src/core/lib/iomgr/iomgr_windows.c', 'src/core/lib/iomgr/load_file.c', 'src/core/lib/iomgr/network_status_tracker.c', 'src/core/lib/iomgr/polling_entity.c', + 'src/core/lib/iomgr/pollset_set_uv.c', 'src/core/lib/iomgr/pollset_set_windows.c', + 'src/core/lib/iomgr/pollset_uv.c', 'src/core/lib/iomgr/pollset_windows.c', 'src/core/lib/iomgr/resolve_address_posix.c', + 'src/core/lib/iomgr/resolve_address_uv.c', 'src/core/lib/iomgr/resolve_address_windows.c', 'src/core/lib/iomgr/sockaddr_utils.c', 'src/core/lib/iomgr/socket_utils_common_posix.c', 'src/core/lib/iomgr/socket_utils_linux.c', 'src/core/lib/iomgr/socket_utils_posix.c', + 'src/core/lib/iomgr/socket_utils_uv.c', 'src/core/lib/iomgr/socket_utils_windows.c', 'src/core/lib/iomgr/socket_windows.c', 'src/core/lib/iomgr/tcp_client_posix.c', + 'src/core/lib/iomgr/tcp_client_uv.c', 'src/core/lib/iomgr/tcp_client_windows.c', 'src/core/lib/iomgr/tcp_posix.c', 'src/core/lib/iomgr/tcp_server_posix.c', + 'src/core/lib/iomgr/tcp_server_uv.c', 'src/core/lib/iomgr/tcp_server_windows.c', + 'src/core/lib/iomgr/tcp_uv.c', 'src/core/lib/iomgr/tcp_windows.c', 'src/core/lib/iomgr/time_averaged_stats.c', - 'src/core/lib/iomgr/timer.c', + 'src/core/lib/iomgr/timer_generic.c', 'src/core/lib/iomgr/timer_heap.c', + 'src/core/lib/iomgr/timer_uv.c', 'src/core/lib/iomgr/udp_server.c', 'src/core/lib/iomgr/unix_sockets_posix.c', 'src/core/lib/iomgr/unix_sockets_posix_noop.c', @@ -473,6 +487,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/wakeup_fd_pipe.c', 'src/core/lib/iomgr/wakeup_fd_posix.c', 'src/core/lib/iomgr/workqueue_posix.c', + 'src/core/lib/iomgr/workqueue_uv.c', 'src/core/lib/iomgr/workqueue_windows.c', 'src/core/lib/json/json.c', 'src/core/lib/json/json_reader.c', @@ -650,6 +665,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/pollset.h', 'src/core/lib/iomgr/pollset_set.h', 'src/core/lib/iomgr/pollset_set_windows.h', + 'src/core/lib/iomgr/pollset_uv.h', 'src/core/lib/iomgr/pollset_windows.h', 'src/core/lib/iomgr/port.h', 'src/core/lib/iomgr/resolve_address.h', @@ -663,16 +679,20 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/tcp_client.h', 'src/core/lib/iomgr/tcp_posix.h', 'src/core/lib/iomgr/tcp_server.h', + 'src/core/lib/iomgr/tcp_uv.h', 'src/core/lib/iomgr/tcp_windows.h', 'src/core/lib/iomgr/time_averaged_stats.h', 'src/core/lib/iomgr/timer.h', + 'src/core/lib/iomgr/timer_generic.h', 'src/core/lib/iomgr/timer_heap.h', + 'src/core/lib/iomgr/timer_uv.h', 'src/core/lib/iomgr/udp_server.h', 'src/core/lib/iomgr/unix_sockets_posix.h', 'src/core/lib/iomgr/wakeup_fd_pipe.h', 'src/core/lib/iomgr/wakeup_fd_posix.h', 'src/core/lib/iomgr/workqueue.h', 'src/core/lib/iomgr/workqueue_posix.h', + 'src/core/lib/iomgr/workqueue_uv.h', 'src/core/lib/iomgr/workqueue_windows.h', 'src/core/lib/json/json.h', 'src/core/lib/json/json_common.h', diff --git a/grpc.gemspec b/grpc.gemspec index 60701d1288..5ab3f91301 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -206,6 +206,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/pollset.h ) s.files += %w( src/core/lib/iomgr/pollset_set.h ) s.files += %w( src/core/lib/iomgr/pollset_set_windows.h ) + s.files += %w( src/core/lib/iomgr/pollset_uv.h ) s.files += %w( src/core/lib/iomgr/pollset_windows.h ) s.files += %w( src/core/lib/iomgr/port.h ) s.files += %w( src/core/lib/iomgr/resolve_address.h ) @@ -219,16 +220,20 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/tcp_client.h ) s.files += %w( src/core/lib/iomgr/tcp_posix.h ) s.files += %w( src/core/lib/iomgr/tcp_server.h ) + s.files += %w( src/core/lib/iomgr/tcp_uv.h ) s.files += %w( src/core/lib/iomgr/tcp_windows.h ) s.files += %w( src/core/lib/iomgr/time_averaged_stats.h ) s.files += %w( src/core/lib/iomgr/timer.h ) + s.files += %w( src/core/lib/iomgr/timer_generic.h ) s.files += %w( src/core/lib/iomgr/timer_heap.h ) + s.files += %w( src/core/lib/iomgr/timer_uv.h ) s.files += %w( src/core/lib/iomgr/udp_server.h ) s.files += %w( src/core/lib/iomgr/unix_sockets_posix.h ) s.files += %w( src/core/lib/iomgr/wakeup_fd_pipe.h ) s.files += %w( src/core/lib/iomgr/wakeup_fd_posix.h ) s.files += %w( src/core/lib/iomgr/workqueue.h ) s.files += %w( src/core/lib/iomgr/workqueue_posix.h ) + s.files += %w( src/core/lib/iomgr/workqueue_uv.h ) s.files += %w( src/core/lib/iomgr/workqueue_windows.h ) s.files += %w( src/core/lib/json/json.h ) s.files += %w( src/core/lib/json/json_common.h ) @@ -361,29 +366,38 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/iocp_windows.c ) s.files += %w( src/core/lib/iomgr/iomgr.c ) s.files += %w( src/core/lib/iomgr/iomgr_posix.c ) + s.files += %w( src/core/lib/iomgr/iomgr_uv.c ) s.files += %w( src/core/lib/iomgr/iomgr_windows.c ) s.files += %w( src/core/lib/iomgr/load_file.c ) s.files += %w( src/core/lib/iomgr/network_status_tracker.c ) s.files += %w( src/core/lib/iomgr/polling_entity.c ) + s.files += %w( src/core/lib/iomgr/pollset_set_uv.c ) s.files += %w( src/core/lib/iomgr/pollset_set_windows.c ) + s.files += %w( src/core/lib/iomgr/pollset_uv.c ) s.files += %w( src/core/lib/iomgr/pollset_windows.c ) s.files += %w( src/core/lib/iomgr/resolve_address_posix.c ) + s.files += %w( src/core/lib/iomgr/resolve_address_uv.c ) s.files += %w( src/core/lib/iomgr/resolve_address_windows.c ) s.files += %w( src/core/lib/iomgr/sockaddr_utils.c ) s.files += %w( src/core/lib/iomgr/socket_utils_common_posix.c ) s.files += %w( src/core/lib/iomgr/socket_utils_linux.c ) s.files += %w( src/core/lib/iomgr/socket_utils_posix.c ) + s.files += %w( src/core/lib/iomgr/socket_utils_uv.c ) s.files += %w( src/core/lib/iomgr/socket_utils_windows.c ) s.files += %w( src/core/lib/iomgr/socket_windows.c ) s.files += %w( src/core/lib/iomgr/tcp_client_posix.c ) + s.files += %w( src/core/lib/iomgr/tcp_client_uv.c ) s.files += %w( src/core/lib/iomgr/tcp_client_windows.c ) s.files += %w( src/core/lib/iomgr/tcp_posix.c ) s.files += %w( src/core/lib/iomgr/tcp_server_posix.c ) + s.files += %w( src/core/lib/iomgr/tcp_server_uv.c ) s.files += %w( src/core/lib/iomgr/tcp_server_windows.c ) + s.files += %w( src/core/lib/iomgr/tcp_uv.c ) s.files += %w( src/core/lib/iomgr/tcp_windows.c ) s.files += %w( src/core/lib/iomgr/time_averaged_stats.c ) - s.files += %w( src/core/lib/iomgr/timer.c ) + s.files += %w( src/core/lib/iomgr/timer_generic.c ) s.files += %w( src/core/lib/iomgr/timer_heap.c ) + s.files += %w( src/core/lib/iomgr/timer_uv.c ) s.files += %w( src/core/lib/iomgr/udp_server.c ) s.files += %w( src/core/lib/iomgr/unix_sockets_posix.c ) s.files += %w( src/core/lib/iomgr/unix_sockets_posix_noop.c ) @@ -392,6 +406,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/wakeup_fd_pipe.c ) s.files += %w( src/core/lib/iomgr/wakeup_fd_posix.c ) s.files += %w( src/core/lib/iomgr/workqueue_posix.c ) + s.files += %w( src/core/lib/iomgr/workqueue_uv.c ) s.files += %w( src/core/lib/iomgr/workqueue_windows.c ) s.files += %w( src/core/lib/json/json.c ) s.files += %w( src/core/lib/json/json_reader.c ) diff --git a/package.xml b/package.xml index d49c124314..9493d01ba2 100644 --- a/package.xml +++ b/package.xml @@ -214,6 +214,7 @@ + @@ -227,16 +228,20 @@ + + + + @@ -369,29 +374,38 @@ + + + + + + + + - + + @@ -400,6 +414,7 @@ + diff --git a/src/core/ext/client_config/client_config_plugin.c b/src/core/ext/client_config/client_config_plugin.c index 5e31613420..e065d06be9 100644 --- a/src/core/ext/client_config/client_config_plugin.c +++ b/src/core/ext/client_config/client_config_plugin.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include #include diff --git a/src/core/ext/client_config/connector.h b/src/core/ext/client_config/connector.h index ea9d23706e..5cf8f14721 100644 --- a/src/core/ext/client_config/connector.h +++ b/src/core/ext/client_config/connector.h @@ -34,6 +34,11 @@ #ifndef GRPC_CORE_EXT_CLIENT_CONFIG_CONNECTOR_H #define GRPC_CORE_EXT_CLIENT_CONFIG_CONNECTOR_H +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/transport/transport.h" diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c index af913d8a9d..a390daec01 100644 --- a/src/core/ext/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/lb_policy/grpclb/grpclb.c @@ -96,6 +96,11 @@ * - Implement LB service forwarding (point 2c. in the doc's diagram). */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include diff --git a/src/core/ext/lb_policy/pick_first/pick_first.c b/src/core/ext/lb_policy/pick_first/pick_first.c index 9decf70692..61b637fe7d 100644 --- a/src/core/ext/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/lb_policy/pick_first/pick_first.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index 7bcf608ab9..da53143948 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -59,6 +59,11 @@ * the subchannel by the caller. */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c index 31ac968670..6a699804fe 100644 --- a/src/core/ext/resolver/dns/native/dns_resolver.c +++ b/src/core/ext/resolver/dns/native/dns_resolver.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include diff --git a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c index d613c5393e..46d185a984 100644 --- a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +++ b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include #include diff --git a/src/core/lib/http/httpcli.h b/src/core/lib/http/httpcli.h index 662e176f4c..eba6ecb9ab 100644 --- a/src/core/lib/http/httpcli.h +++ b/src/core/lib/http/httpcli.h @@ -34,6 +34,11 @@ #ifndef GRPC_CORE_LIB_HTTP_HTTPCLI_H #define GRPC_CORE_LIB_HTTP_HTTPCLI_H +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include diff --git a/src/core/lib/iomgr/iomgr.h b/src/core/lib/iomgr/iomgr.h index 6c82de78ac..c1cfaf302e 100644 --- a/src/core/lib/iomgr/iomgr.h +++ b/src/core/lib/iomgr/iomgr.h @@ -34,6 +34,8 @@ #ifndef GRPC_CORE_LIB_IOMGR_IOMGR_H #define GRPC_CORE_LIB_IOMGR_IOMGR_H +#include "src/core/lib/iomgr/port.h" + /** Initializes the iomgr. */ void grpc_iomgr_init(void); diff --git a/src/core/lib/iomgr/iomgr_uv.c b/src/core/lib/iomgr/iomgr_uv.c new file mode 100644 index 0000000000..4c8acfbd96 --- /dev/null +++ b/src/core/lib/iomgr/iomgr_uv.c @@ -0,0 +1,51 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include "src/core/lib/debug/trace.h" +#include "src/core/lib/iomgr/pollset_uv.h" +#include "src/core/lib/iomgr/tcp_uv.h" + +void grpc_iomgr_platform_init(void) { + grpc_pollset_global_init(); + grpc_register_tracer("tcp", &grpc_tcp_trace); +} +void grpc_iomgr_platform_flush(void) {} +void grpc_iomgr_platform_shutdown(void) { + grpc_pollset_global_shutdown(); +} + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/pollset_set_uv.c b/src/core/lib/iomgr/pollset_set_uv.c new file mode 100644 index 0000000000..e5ef8b29e0 --- /dev/null +++ b/src/core/lib/iomgr/pollset_set_uv.c @@ -0,0 +1,62 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include "src/core/lib/iomgr/pollset_set.h" + +grpc_pollset_set* grpc_pollset_set_create(void) { + return (grpc_pollset_set*)((intptr_t)0xdeafbeef); +} + +void grpc_pollset_set_destroy(grpc_pollset_set* pollset_set) {} + +void grpc_pollset_set_add_pollset(grpc_exec_ctx* exec_ctx, + grpc_pollset_set* pollset_set, + grpc_pollset* pollset) {} + +void grpc_pollset_set_del_pollset(grpc_exec_ctx* exec_ctx, + grpc_pollset_set* pollset_set, + grpc_pollset* pollset) {} + +void grpc_pollset_set_add_pollset_set(grpc_exec_ctx* exec_ctx, + grpc_pollset_set* bag, + grpc_pollset_set* item) {} + +void grpc_pollset_set_del_pollset_set(grpc_exec_ctx* exec_ctx, + grpc_pollset_set* bag, + grpc_pollset_set* item) {} + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/pollset_set_windows.c b/src/core/lib/iomgr/pollset_set_windows.c index 645650db9b..293893f18e 100644 --- a/src/core/lib/iomgr/pollset_set_windows.c +++ b/src/core/lib/iomgr/pollset_set_windows.c @@ -31,8 +31,8 @@ * */ -#include #include "src/core/lib/iomgr/port.h" +#include #ifdef GRPC_WINSOCK_SOCKET diff --git a/src/core/lib/iomgr/pollset_uv.c b/src/core/lib/iomgr/pollset_uv.c new file mode 100644 index 0000000000..2c41a58c30 --- /dev/null +++ b/src/core/lib/iomgr/pollset_uv.c @@ -0,0 +1,84 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include + +#include "src/core/lib/iomgr/pollset.h" +#include "src/core/lib/iomgr/pollset_uv.h" + +gpr_mu grpc_polling_mu; + +size_t grpc_pollset_size() { + return 1; +} + +void grpc_pollset_global_init(void) { + gpr_mu_init(&grpc_polling_mu); +} + +void grpc_pollset_global_shutdown(void) { gpr_mu_destroy(&grpc_polling_mu); } + +void grpc_pollset_init(grpc_pollset *pollset, gpr_mu **mu) { + *mu = &grpc_polling_mu; +} + +void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, + grpc_closure *closure) { + grpc_exec_ctx_sched(exec_ctx, closure, GRPC_ERROR_NONE, NULL); +} + +void grpc_pollset_destroy(grpc_pollset *pollset) {} + +void grpc_pollset_reset(grpc_pollset *pollset) {} + +grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, + grpc_pollset_worker **worker_hdl, + gpr_timespec now, gpr_timespec deadline) { + if (!grpc_closure_list_empty(exec_ctx->closure_list)) { + gpr_mu_unlock(&grpc_polling_mu); + grpc_exec_ctx_flush(exec_ctx); + gpr_mu_lock(&grpc_polling_mu); + } + return GRPC_ERROR_NONE; +} + +grpc_error *grpc_pollset_kick(grpc_pollset *pollset, + grpc_pollset_worker *specific_worker) { + return GRPC_ERROR_NONE; +} + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/pollset_uv.h b/src/core/lib/iomgr/pollset_uv.h new file mode 100644 index 0000000000..5cbc83e991 --- /dev/null +++ b/src/core/lib/iomgr/pollset_uv.h @@ -0,0 +1,35 @@ +/* + * + * Copyright 2016, 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. + * + */ + +void grpc_pollset_global_init(void); +void grpc_pollset_global_shutdown(void); diff --git a/src/core/lib/iomgr/port.h b/src/core/lib/iomgr/port.h index e6f01802ed..60bb16a423 100644 --- a/src/core/lib/iomgr/port.h +++ b/src/core/lib/iomgr/port.h @@ -36,7 +36,9 @@ #ifndef GRPC_CORE_LIB_IOMGR_PORT_H #define GRPC_CORE_LIB_IOMGR_PORT_H -#if defined(GPR_MANYLINUX1) +#if defined(GRPC_UV) +#include +#elif defined(GPR_MANYLINUX1) #define GRPC_HAVE_IPV6_RECVPKTINFO 1 #define GRPC_HAVE_IP_PKTINFO 1 #define GRPC_HAVE_MSG_NOSIGNAL 1 @@ -46,7 +48,9 @@ #define GRPC_POSIX_SOCKETADDR 1 #define GRPC_POSIX_SOCKETUTILS 1 #define GRPC_POSIX_WAKEUP_FD 1 +#define GRPC_TIMER_USE_GENERIC 1 #elif defined(GPR_WINDOWS) +#define GRPC_TIMER_USE_GENERIC 1 #define GRPC_WINSOCK_SOCKET 1 #define GRPC_WINDOWS_SOCKETUTILS 1 #elif defined(GPR_ANDROID) @@ -59,6 +63,7 @@ #define GRPC_POSIX_SOCKETADDR 1 #define GRPC_POSIX_SOCKETUTILS 1 #define GRPC_POSIX_WAKEUP_FD 1 +#define GRPC_TIMER_USE_GENERIC 1 #elif defined(GPR_LINUX) #define GRPC_HAVE_IPV6_RECVPKTINFO 1 #define GRPC_HAVE_IP_PKTINFO 1 @@ -68,6 +73,7 @@ #define GRPC_POSIX_SOCKET 1 #define GRPC_POSIX_SOCKETADDR 1 #define GRPC_POSIX_WAKEUP_FD 1 +#define GRPC_TIMER_USE_GENERIC 1 #ifdef __GLIBC_PREREQ #if __GLIBC_PREREQ(2, 9) #define GRPC_LINUX_EPOLL 1 @@ -93,6 +99,7 @@ #define GRPC_POSIX_SOCKETADDR 1 #define GRPC_POSIX_SOCKETUTILS 1 #define GRPC_POSIX_WAKEUP_FD 1 +#define GRPC_TIMER_USE_GENERIC 1 #elif defined(GPR_FREEBSD) #define GRPC_HAVE_IPV6_RECVPKTINFO 1 #define GRPC_HAVE_IP_PKTINFO 1 @@ -103,18 +110,20 @@ #define GRPC_POSIX_SOCKETADDR 1 #define GRPC_POSIX_SOCKETUTILS 1 #define GRPC_POSIX_WAKEUP_FD 1 +#define GRPC_TIMER_USE_GENERIC 1 #elif defined(GPR_NACL) #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 #define GRPC_POSIX_SOCKET 1 #define GRPC_POSIX_SOCKETADDR 1 #define GRPC_POSIX_SOCKETUTILS 1 #define GRPC_POSIX_WAKEUP_FD 1 +#define GRPC_TIMER_USE_GENERIC 1 #elif !defined(GPR_NO_AUTODETECT_PLATFORM) #error "Platform not recognized" #endif #if defined(GRPC_POSIX_SOCKET) + defined(GRPC_WINSOCK_SOCKET) + \ - defined(GRPC_CUSTOM_SOCKET) != \ + defined(GRPC_CUSTOM_SOCKET) + defined(GRPC_UV) != \ 1 #error Must define exactly one of GRPC_POSIX_SOCKET, GRPC_WINSOCK_SOCKET, GPR_CUSTOM_SOCKET #endif diff --git a/src/core/lib/iomgr/resolve_address_uv.c b/src/core/lib/iomgr/resolve_address_uv.c new file mode 100644 index 0000000000..550047b4d2 --- /dev/null +++ b/src/core/lib/iomgr/resolve_address_uv.c @@ -0,0 +1,234 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" +#ifdef GRPC_UV + +#include + +#include +#include +#include +#include + +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/error.h" +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/resolve_address.h" +#include "src/core/lib/iomgr/sockaddr_utils.h" + +#include + +typedef struct request { + grpc_closure *on_done; + grpc_resolved_addresses **addresses; + struct addrinfo *hints; +} request; + +static grpc_error *handle_addrinfo_result(int status, + struct addrinfo *result, + grpc_resolved_addresses **addresses) { + + struct addrinfo *resp; + size_t i; + if (status != 0) { + grpc_error *error; + *addresses = NULL; + error = GRPC_ERROR_CREATE("getaddrinfo failed"); + error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, + uv_strerror(status)); + return error; + } + (*addresses) = gpr_malloc(sizeof(grpc_resolved_addresses)); + (*addresses)->naddrs = 0; + for (resp = result; resp != NULL; resp = resp->ai_next) { + (*addresses)->naddrs++; + } + (*addresses)->addrs = + gpr_malloc(sizeof(grpc_resolved_address) * (*addresses)->naddrs); + i = 0; + for (resp = result; resp != NULL; resp = resp->ai_next) { + memcpy(&(*addresses)->addrs[i].addr, resp->ai_addr, resp->ai_addrlen); + (*addresses)->addrs[i].len = resp->ai_addrlen; + i++; + } + + { + for (i = 0; i < (*addresses)->naddrs; i++) { + char *buf; + grpc_sockaddr_to_string( + &buf, (struct sockaddr *)&(*addresses)->addrs[i].addr, 0); + gpr_free(buf); + } + } + return GRPC_ERROR_NONE; +} + +static void getaddrinfo_callback(uv_getaddrinfo_t *req, int status, + struct addrinfo *res) { + request *r = (request *)req->data; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_error *error; + error = handle_addrinfo_result(status, res, r->addresses); + grpc_exec_ctx_sched(&exec_ctx, r->on_done, error, NULL); + grpc_exec_ctx_finish(&exec_ctx); + + gpr_free(r->hints); + gpr_free(r); + gpr_free(req); + uv_freeaddrinfo(res); +} + +static grpc_error *try_split_host_port(const char *name, + const char *default_port, char **host, + char **port) { + /* parse name, splitting it into host and port parts */ + grpc_error *error; + gpr_split_host_port(name, host, port); + if (host == NULL) { + char *msg; + gpr_asprintf(&msg, "unparseable host:port: '%s'", name); + error = GRPC_ERROR_CREATE(msg); + gpr_free(msg); + return error; + } + if (port == NULL) { + if (default_port == NULL) { + char *msg; + gpr_asprintf(&msg, "no port in name '%s'", name); + error = GRPC_ERROR_CREATE(msg); + gpr_free(msg); + return error; + } + *port = gpr_strdup(default_port); + } + return GRPC_ERROR_NONE; +} + +static grpc_error *blocking_resolve_address_impl( + const char *name, const char *default_port, + grpc_resolved_addresses **addresses) { + char *host; + char *port; + struct addrinfo hints; + uv_getaddrinfo_t req; + int s; + grpc_error *err; + + err = try_split_host_port(name, default_port, &host, &port); + if (err != GRPC_ERROR_NONE) { + goto done; + } + + /* Call getaddrinfo */ + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_UNSPEC; /* ipv4 or ipv6 */ + hints.ai_socktype = SOCK_STREAM; /* stream socket */ + hints.ai_flags = AI_PASSIVE; /* for wildcard IP address */ + + s = uv_getaddrinfo(uv_default_loop(), &req, NULL, host, port, &hints); + err = handle_addrinfo_result(s, req.addrinfo, addresses); + +done: + gpr_free(host); + gpr_free(port); + if (req.addrinfo) { + uv_freeaddrinfo(req.addrinfo); + } + return err; +} + + + +grpc_error *(*grpc_blocking_resolve_address)( + const char *name, const char *default_port, + grpc_resolved_addresses **addresses) = blocking_resolve_address_impl; + +void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addrs) { + if (addrs != NULL) { + gpr_free(addrs->addrs); + } + gpr_free(addrs); +} + +static void resolve_address_impl(grpc_exec_ctx *exec_ctx, const char *name, + const char *default_port, + grpc_closure *on_done, + grpc_resolved_addresses **addrs) { + uv_getaddrinfo_t *req; + request *r; + struct addrinfo *hints; + char *host; + char *port; + grpc_error *err; + int s; + err = try_split_host_port(name, default_port, &host, &port); + if (err != GRPC_ERROR_NONE) { + grpc_exec_ctx_sched(exec_ctx, on_done, err, NULL); + return; + } + r = gpr_malloc(sizeof(request)); + r->on_done = on_done; + r->addresses = addrs; + req = gpr_malloc(sizeof(uv_getaddrinfo_t)); + req->data = r; + + /* Call getaddrinfo */ + hints = gpr_malloc(sizeof(struct addrinfo)); + memset(hints, 0, sizeof(struct addrinfo)); + hints->ai_family = AF_UNSPEC; /* ipv4 or ipv6 */ + hints->ai_socktype = SOCK_STREAM; /* stream socket */ + hints->ai_flags = AI_PASSIVE; /* for wildcard IP address */ + r->hints = hints; + + s = uv_getaddrinfo(uv_default_loop(), req, getaddrinfo_callback, host, port, + hints); + + if (s != 0) { + *addrs = NULL; + err = GRPC_ERROR_CREATE("getaddrinfo failed"); + err = grpc_error_set_str(err, GRPC_ERROR_STR_OS_ERROR, + uv_strerror(s)); + grpc_exec_ctx_sched(exec_ctx, on_done, err, NULL); + gpr_free(r); + gpr_free(req); + gpr_free(hints); + } +} + +void (*grpc_resolve_address)(grpc_exec_ctx *exec_ctx, const char *name, + const char *default_port, grpc_closure *on_done, + grpc_resolved_addresses **addrs) = + resolve_address_impl; + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/sockaddr.h b/src/core/lib/iomgr/sockaddr.h index 58cae6cc01..418488a0ea 100644 --- a/src/core/lib/iomgr/sockaddr.h +++ b/src/core/lib/iomgr/sockaddr.h @@ -36,6 +36,10 @@ #include "src/core/lib/iomgr/port.h" +#ifdef GRPC_UV +#include +#endif + #ifdef GPR_WINDOWS #include "src/core/lib/iomgr/sockaddr_windows.h" #endif diff --git a/src/core/lib/iomgr/socket_utils.h b/src/core/lib/iomgr/socket_utils.h index 6ce9a6859c..b01197ad18 100644 --- a/src/core/lib/iomgr/socket_utils.h +++ b/src/core/lib/iomgr/socket_utils.h @@ -36,10 +36,12 @@ #include "src/core/lib/iomgr/port.h" -#ifdef GRPC_WINSOCK_SOCKET +#if defined(GRPC_WINSOCK_SOCKET) #include "src/core/lib/iomgr/sockaddr_windows.h" -#else +#elif defined(GRPC_POSIX_SOCKET) #include "src/core/lib/iomgr/sockaddr_posix.h" +#elif defined(GRPC_UV) +#include #endif /* A wrapper for inet_ntop on POSIX systems and InetNtop on Windows systems */ diff --git a/src/core/lib/iomgr/socket_utils_uv.c b/src/core/lib/iomgr/socket_utils_uv.c new file mode 100644 index 0000000000..7f61384e74 --- /dev/null +++ b/src/core/lib/iomgr/socket_utils_uv.c @@ -0,0 +1,50 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include + +#include "src/core/lib/iomgr/socket_utils.h" + +#include + +const char *grpc_inet_ntop(int af, const void *src, char *dst, socklen_t size) { + GPR_ASSERT(sizeof(socklen_t) <= sizeof(size_t)); + uv_inet_ntop(af, src, dst, (size_t)size); + return dst; +} + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/tcp_client_uv.c b/src/core/lib/iomgr/tcp_client_uv.c new file mode 100644 index 0000000000..7823a1d873 --- /dev/null +++ b/src/core/lib/iomgr/tcp_client_uv.c @@ -0,0 +1,142 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include + +#include +#include + +#include "src/core/lib/iomgr/error.h" +#include "src/core/lib/iomgr/sockaddr_utils.h" +#include "src/core/lib/iomgr/tcp_client.h" +#include "src/core/lib/iomgr/tcp_uv.h" +#include "src/core/lib/iomgr/timer.h" + +typedef struct grpc_uv_tcp_connect { + uv_connect_t connect_req; + grpc_timer alarm; + uv_tcp_t *tcp_handle; + grpc_closure *closure; + grpc_endpoint **endpoint; + int refs; + char *addr_name; +} grpc_uv_tcp_connect; + +static void uv_tcp_connect_cleanup(grpc_uv_tcp_connect *connect) { + gpr_free(connect); +} + +static void tcp_close_callback(uv_handle_t *handle) { + gpr_log(GPR_DEBUG, "Freeing uv_tcp_t handle %p", handle); + gpr_free(handle); +} + +static void uv_tc_on_alarm(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { + int done; + grpc_uv_tcp_connect *connect = acp; + if (error == GRPC_ERROR_NONE) { + /* error == NONE implies that the timer ran out, and wasn't cancelled. If + it was cancelled, then the handler that cancelled it also should close + the handle, if applicable */ + gpr_log(GPR_DEBUG, "Closing uv_tcp_t handle %p", connect->tcp_handle); + uv_close((uv_handle_t *)connect->tcp_handle, tcp_close_callback); + } + done = (--connect->refs == 0); + if (done) { + uv_tcp_connect_cleanup(connect); + } +} + +static void uv_tc_on_connect(uv_connect_t *req, int status) { + grpc_uv_tcp_connect *connect = req->data; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_error *error = GRPC_ERROR_NONE; + int done; + grpc_closure *closure = connect->closure; + grpc_timer_cancel(&exec_ctx, &connect->alarm); + if (status == 0) { + *connect->endpoint = grpc_tcp_create(connect->tcp_handle, + connect->addr_name); + } else { + error = GRPC_ERROR_CREATE("Failed to connect to remote host"); + error = grpc_error_set_int(error, GRPC_ERROR_INT_ERRNO, -status); + error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, + uv_strerror(status)); + if (status == UV_ECANCELED) { + error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, + "Timeout occurred"); + // This should only happen if the handle is already closed + } else { + error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, + uv_strerror(status)); + gpr_log(GPR_DEBUG, "Closing uv_tcp_t handle %p", connect->tcp_handle); + uv_close((uv_handle_t *)connect->tcp_handle, tcp_close_callback); + } + } + done = (--connect->refs == 0); + if (done) { + uv_tcp_connect_cleanup(connect); + } + grpc_exec_ctx_sched(&exec_ctx, closure, error, NULL); + grpc_exec_ctx_finish(&exec_ctx); +} + +void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, + grpc_closure *closure, grpc_endpoint **ep, + grpc_pollset_set *interested_parties, + const struct sockaddr *addr, + size_t addr_len, gpr_timespec deadline) { + grpc_uv_tcp_connect *connect; + (void)interested_parties; + connect = gpr_malloc(sizeof(grpc_uv_tcp_connect)); + memset(connect, 0, sizeof(grpc_uv_tcp_connect)); + connect->closure = closure; + connect->endpoint = ep; + connect->tcp_handle = gpr_malloc(sizeof(uv_tcp_t)); + gpr_log(GPR_DEBUG, "Allocated uv_tcp_t handle %p", connect->tcp_handle); + connect->addr_name = grpc_sockaddr_to_uri(addr); + uv_tcp_init(uv_default_loop(), connect->tcp_handle); + connect->connect_req.data = connect; + // TODO(murgatroid99): figure out what the return value here means + uv_tcp_connect(&connect->connect_req, connect->tcp_handle, addr, + uv_tc_on_connect); + grpc_timer_init(exec_ctx, &connect->alarm, + gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC), + uv_tc_on_alarm, connect, gpr_now(GPR_CLOCK_MONOTONIC)); +} + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/tcp_server_uv.c b/src/core/lib/iomgr/tcp_server_uv.c new file mode 100644 index 0000000000..b69e70881f --- /dev/null +++ b/src/core/lib/iomgr/tcp_server_uv.c @@ -0,0 +1,358 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include + +#include +#include + +#include "src/core/lib/iomgr/error.h" +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/sockaddr_utils.h" +#include "src/core/lib/iomgr/tcp_server.h" +#include "src/core/lib/iomgr/tcp_uv.h" + +/* one listening port */ +typedef struct grpc_tcp_listener grpc_tcp_listener; +struct grpc_tcp_listener { + uv_tcp_t *handle; + grpc_tcp_server *server; + unsigned port_index; + int port; + /* linked list */ + struct grpc_tcp_listener *next; +}; + +struct grpc_tcp_server { + gpr_refcount refs; + + /* Called whenever accept() succeeds on a server port. */ + grpc_tcp_server_cb on_accept_cb; + void *on_accept_cb_arg; + + int open_ports; + + /* linked list of server ports */ + grpc_tcp_listener *head; + grpc_tcp_listener *tail; + + /* List of closures passed to shutdown_starting_add(). */ + grpc_closure_list shutdown_starting; + + /* shutdown callback */ + grpc_closure *shutdown_complete; +}; + +grpc_error *grpc_tcp_server_create(grpc_closure *shutdown_complete, + const grpc_channel_args *args, + grpc_tcp_server **server) { + grpc_tcp_server *s = gpr_malloc(sizeof(grpc_tcp_server)); + (void)args; + gpr_ref_init(&s->refs, 1); + s->on_accept_cb = NULL; + s->on_accept_cb_arg = NULL; + s->open_ports = 0; + s->head = NULL; + s->tail = NULL; + s->shutdown_starting.head = NULL; + s->shutdown_starting.tail = NULL; + s->shutdown_complete = shutdown_complete; + *server = s; + return GRPC_ERROR_NONE; +} + +grpc_tcp_server *grpc_tcp_server_ref(grpc_tcp_server *s) { + gpr_ref(&s->refs); + return s; +} + +void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server *s, + grpc_closure *shutdown_starting) { + grpc_closure_list_append(&s->shutdown_starting, shutdown_starting, + GRPC_ERROR_NONE); +} + +static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { + if (s->shutdown_complete != NULL) { + grpc_exec_ctx_sched(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE, NULL); + } + + while (s->head) { + grpc_tcp_listener *sp = s->head; + s->head = sp->next; + sp->next = NULL; + gpr_log(GPR_DEBUG, "Freeing uv_tcp_t handle %p", sp->handle); + gpr_free(sp->handle); + gpr_free(sp); + } + gpr_free(s); +} + +static void handle_close_callback(uv_handle_t *handle) { + grpc_tcp_listener *sp = (grpc_tcp_listener *)handle->data; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + sp->server->open_ports--; + if (sp->server->open_ports == 0) { + finish_shutdown(&exec_ctx, sp->server); + } + grpc_exec_ctx_finish(&exec_ctx); +} + +static void tcp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { + int immediately_done = 0; + grpc_tcp_listener *sp; + + if (s->open_ports == 0) { + immediately_done = 1; + } + for (sp = s->head; sp; sp = sp->next){ + gpr_log(GPR_DEBUG, "Closing uv_tcp_t handle %p", sp->handle); + uv_close((uv_handle_t *)sp->handle, handle_close_callback); + } + + if (immediately_done) { + finish_shutdown(exec_ctx, s); + } +} + +void grpc_tcp_server_unref(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { + if (gpr_unref(&s->refs)) { + /* Complete shutdown_starting work before destroying. */ + grpc_exec_ctx local_exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_exec_ctx_enqueue_list(&local_exec_ctx, &s->shutdown_starting, NULL); + if (exec_ctx == NULL) { + grpc_exec_ctx_flush(&local_exec_ctx); + tcp_server_destroy(&local_exec_ctx, s); + grpc_exec_ctx_finish(&local_exec_ctx); + } else { + grpc_exec_ctx_finish(&local_exec_ctx); + tcp_server_destroy(exec_ctx, s); + } + } +} + +static void on_connect(uv_stream_t *server, int status) { + grpc_tcp_listener *sp = (grpc_tcp_listener *)server->data; + grpc_tcp_server_acceptor acceptor = {sp->server, sp->port_index, 0}; + uv_tcp_t *client; + grpc_endpoint *ep = NULL; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + struct sockaddr_storage peer_name; + int peer_name_len = sizeof(peer_name); + char *peer_name_string; + int err; + + gpr_log(GPR_DEBUG, "Server %p received a connection", sp->server); + + if (status < 0) { + gpr_log(GPR_INFO, "Skipping on_accept due to error: %s", + uv_strerror(status)); + return; + } + client = gpr_malloc(sizeof(uv_tcp_t)); + gpr_log(GPR_DEBUG, "Allocated uv_tcp_t handle %p", client); + uv_tcp_init(uv_default_loop(), client); + // UV documentation says this is guaranteed to succeed + uv_accept((uv_stream_t *)server, (uv_stream_t *)client); + peer_name_string = NULL; + err = uv_tcp_getpeername(client, (struct sockaddr *)&peer_name, + &peer_name_len); + if (err == 0) { + peer_name_string = grpc_sockaddr_to_uri((struct sockaddr *)&peer_name); + } else { + gpr_log(GPR_INFO, "uv_tcp_getpeername error: %s", + uv_strerror(status)); + } + ep = grpc_tcp_create(client, peer_name_string); + gpr_log(GPR_DEBUG, "Calling on_accept_cb for server %p", sp->server); + sp->server->on_accept_cb(&exec_ctx, sp->server->on_accept_cb_arg, ep, NULL, + &acceptor); + grpc_exec_ctx_finish(&exec_ctx); +} + +static grpc_error *add_socket_to_server(grpc_tcp_server *s, + uv_tcp_t *handle, + struct sockaddr *addr, + size_t addr_len, unsigned port_index, + grpc_tcp_listener **listener) { + grpc_tcp_listener *sp = NULL; + int port = -1; + int status; + grpc_error *error; + struct sockaddr_storage sockname_temp; + int sockname_len; + + // The last argument to uv_tcp_bind is flags + status = uv_tcp_bind(handle, addr, 0); + if (status != 0) { + error = GRPC_ERROR_CREATE("Failed to bind to port"); + error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, + uv_strerror(status)); + return error; + } + + sockname_len = (int)sizeof(sockname_temp); + status = uv_tcp_getsockname(handle, (struct sockaddr *)&sockname_temp, + &sockname_len); + if (status != 0) { + error = GRPC_ERROR_CREATE("getsockname failed"); + error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, + uv_strerror(status)); + return error; + } + + port = grpc_sockaddr_get_port((struct sockaddr *)&sockname_temp); + + GPR_ASSERT(port >= 0); + GPR_ASSERT(!s->on_accept_cb && "must add ports before starting server"); + sp = gpr_malloc(sizeof(grpc_tcp_listener)); + sp->next = NULL; + if (s->head == NULL) { + s->head = sp; + } else { + s->tail->next = sp; + } + s->tail = sp; + sp->server = s; + sp->handle = handle; + sp->port = port; + sp->port_index = port_index; + handle->data = sp; + s->open_ports++; + GPR_ASSERT(sp->handle); + *listener = sp; + + return GRPC_ERROR_NONE; +} + +grpc_error *grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr, + size_t addr_len, int *port) { + // This function is mostly copied from tcp_server_windows.c + grpc_tcp_listener *sp = NULL; + uv_tcp_t *handle; + struct sockaddr_in6 addr6_v4mapped; + struct sockaddr_in6 wildcard; + struct sockaddr *allocated_addr = NULL; + struct sockaddr_storage sockname_temp; + int sockname_len; + unsigned port_index = 0; + int status; + grpc_error *error = GRPC_ERROR_NONE; + + if (s->tail != NULL) { + port_index = s->tail->port_index + 1; + } + + /* Check if this is a wildcard port, and if so, try to keep the port the same + as some previously created listener. */ + if (grpc_sockaddr_get_port(addr) == 0) { + for (sp = s->head; sp; sp = sp->next) { + sockname_len = sizeof(sockname_temp); + if (0 == uv_tcp_getsockname(sp->handle, (struct sockaddr *)&sockname_temp, + &sockname_len)) { + *port = grpc_sockaddr_get_port((struct sockaddr *)&sockname_temp); + if (*port > 0) { + allocated_addr = gpr_malloc(addr_len); + memcpy(allocated_addr, addr, addr_len); + grpc_sockaddr_set_port(allocated_addr, *port); + addr = allocated_addr; + break; + } + } + } + } + + if (grpc_sockaddr_to_v4mapped(addr, &addr6_v4mapped)) { + addr = (const struct sockaddr *)&addr6_v4mapped; + addr_len = sizeof(addr6_v4mapped); + } + + /* Treat :: or 0.0.0.0 as a family-agnostic wildcard. */ + if (grpc_sockaddr_is_wildcard(addr, port)) { + grpc_sockaddr_make_wildcard6(*port, &wildcard); + + addr = (struct sockaddr *)&wildcard; + addr_len = sizeof(wildcard); + } + + handle = gpr_malloc(sizeof(uv_tcp_t)); + gpr_log(GPR_DEBUG, "Allocating uv_tcp_t handle %p", handle); + status = uv_tcp_init(uv_default_loop(), handle); + if (status == 0) { + error = add_socket_to_server(s, handle, (struct sockaddr *)addr, addr_len, + port_index, &sp); + } else { + error = GRPC_ERROR_CREATE("Failed to initialize UV tcp handle"); + error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, + uv_strerror(status)); + } + + gpr_free(allocated_addr); + + if (error != GRPC_ERROR_NONE) { + grpc_error *error_out = GRPC_ERROR_CREATE_REFERENCING( + "Failed to add port to server", &error, 1); + GRPC_ERROR_UNREF(error); + error = error_out; + *port = -1; + } else { + GPR_ASSERT(sp != NULL); + *port = sp->port; + } + return error; +} + +void grpc_tcp_server_start(grpc_exec_ctx *exec_ctx, grpc_tcp_server *server, + grpc_pollset **pollsets, size_t pollset_count, + grpc_tcp_server_cb on_accept_cb, void *cb_arg) { + grpc_tcp_listener *sp; + (void)pollsets; + (void)pollset_count; + GPR_ASSERT(on_accept_cb); + GPR_ASSERT(!server->on_accept_cb); + server->on_accept_cb = on_accept_cb; + server->on_accept_cb_arg = cb_arg; + for(sp = server->head; sp; sp = sp->next) { + GPR_ASSERT(uv_listen((uv_stream_t *) sp->handle, SOMAXCONN, on_connect) == 0); + } +} + +void grpc_tcp_server_shutdown_listeners(grpc_exec_ctx *exec_ctx, + grpc_tcp_server *s) {} + + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c new file mode 100644 index 0000000000..fa198fd8e1 --- /dev/null +++ b/src/core/lib/iomgr/tcp_uv.c @@ -0,0 +1,336 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include +#include + +#include +#include +#include +#include + +#include "src/core/lib/iomgr/error.h" +#include "src/core/lib/iomgr/network_status_tracker.h" +#include "src/core/lib/iomgr/tcp_uv.h" +#include "src/core/lib/support/string.h" + +int grpc_tcp_trace = 0; + +typedef struct { + grpc_endpoint base; + gpr_refcount refcount; + + uv_tcp_t *handle; + + grpc_closure *read_cb; + grpc_closure *write_cb; + + gpr_slice read_slice; + gpr_slice_buffer *read_slices; + gpr_slice_buffer *write_slices; + uv_buf_t *write_buffers; + + int shutting_down; + char *peer_string; + grpc_pollset *pollset; +} grpc_tcp; + +static void uv_close_callback(uv_handle_t *handle) { + gpr_log(GPR_DEBUG, "Freeing uv_tcp_t handle %p", handle); + gpr_free(handle); +} + +static void tcp_free(grpc_tcp *tcp) { + gpr_free(tcp); +} + +/*#define GRPC_TCP_REFCOUNT_DEBUG*/ +#ifdef GRPC_TCP_REFCOUNT_DEBUG +#define TCP_UNREF(tcp, reason) \ + tcp_unref((tcp), (reason), __FILE__, __LINE__) +#define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) +static void tcp_unref(grpc_tcp *tcp, const char *reason, const char *file, + int line) { + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %d -> %d", tcp, + reason, tcp->refcount.count, tcp->refcount.count - 1); + if (gpr_unref(&tcp->refcount)) { + tcp_free(tcp); + } +} + +static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, + int line) { + gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %d -> %d", tcp, + reason, tcp->refcount.count, tcp->refcount.count + 1); + gpr_ref(&tcp->refcount); +} +#else +#define TCP_UNREF(tcp, reason) tcp_unref((tcp)) +#define TCP_REF(tcp, reason) tcp_ref((tcp)) +static void tcp_unref(grpc_tcp *tcp) { + if (gpr_unref(&tcp->refcount)) { + tcp_free(tcp); + } +} + +static void tcp_ref(grpc_tcp *tcp) { gpr_ref(&tcp->refcount); } +#endif + +static void alloc_uv_buf(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) { + grpc_tcp *tcp = handle->data; + (void)suggested_size; + tcp->read_slice = gpr_slice_malloc(GRPC_TCP_DEFAULT_READ_SLICE_SIZE); + buf->base = (char *)GPR_SLICE_START_PTR(tcp->read_slice); + buf->len = GPR_SLICE_LENGTH(tcp->read_slice); +} + +static void read_callback(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) { + gpr_slice sub; + grpc_error *error; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_tcp *tcp = stream->data; + grpc_closure *cb = tcp->read_cb; + if (nread == 0) { + // Nothing happened. Wait for the next callback + return; + } + TCP_UNREF(tcp, "read"); + tcp->read_cb = NULL; + // TODO(murgatroid99): figure out what the return value here means + uv_read_stop(stream); + if (nread == UV_EOF) { + error = GRPC_ERROR_CREATE("EOF"); + } else if (nread > 0) { + // Successful read + sub = gpr_slice_sub_no_ref(tcp->read_slice, 0, nread); + gpr_slice_buffer_add(tcp->read_slices, sub); + error = GRPC_ERROR_NONE; + if (grpc_tcp_trace) { + size_t i; + const char *str = grpc_error_string(error); + gpr_log(GPR_DEBUG, "read: error=%s", str); + grpc_error_free_string(str); + for (i = 0; i < tcp->read_slices->count; i++) { + char *dump = gpr_dump_slice(tcp->read_slices->slices[i], + GPR_DUMP_HEX | GPR_DUMP_ASCII); + gpr_log(GPR_DEBUG, "READ %p (peer=%s): %s", tcp, tcp->peer_string, dump); + gpr_free(dump); + } + } + } else { + // nread < 0: Error + error = GRPC_ERROR_CREATE("TCP Read failed"); + } + grpc_exec_ctx_sched(&exec_ctx, cb, error, NULL); + grpc_exec_ctx_finish(&exec_ctx); +} + +static void uv_endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + gpr_slice_buffer *read_slices, grpc_closure *cb) { + grpc_tcp *tcp = (grpc_tcp *)ep; + int status; + grpc_error *error = GRPC_ERROR_NONE; + GPR_ASSERT(tcp->read_cb == NULL); + tcp->read_cb = cb; + tcp->read_slices = read_slices; + gpr_slice_buffer_reset_and_unref(read_slices); + TCP_REF(tcp, "read"); + // TODO(murgatroid99): figure out what the return value here means + status = uv_read_start((uv_stream_t *)tcp->handle, alloc_uv_buf, read_callback); + if (status != 0) { + error = GRPC_ERROR_CREATE("TCP Read failed at start"); + error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, + uv_strerror(status)); + grpc_exec_ctx_sched(exec_ctx, cb, error, NULL); + } + if (grpc_tcp_trace) { + const char *str = grpc_error_string(error); + gpr_log(GPR_DEBUG, "Initiating read on %p: error=%s", tcp, str); + } +} + +static void write_callback(uv_write_t *req, int status) { + grpc_tcp *tcp = req->data; + grpc_error *error; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_closure *cb = tcp->write_cb; + tcp->write_cb = NULL; + TCP_UNREF(tcp, "write"); + if (status == 0) { + error = GRPC_ERROR_NONE; + } else { + error = GRPC_ERROR_CREATE("TCP Write failed"); + } + if (grpc_tcp_trace) { + const char *str = grpc_error_string(error); + gpr_log(GPR_DEBUG, "write complete on %p: error=%s", tcp, str); + } + gpr_free(tcp->write_buffers); + gpr_free(req); + grpc_exec_ctx_sched(&exec_ctx, cb, error, NULL); + grpc_exec_ctx_finish(&exec_ctx); +} + +static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + gpr_slice_buffer *write_slices, + grpc_closure *cb) { + grpc_tcp *tcp = (grpc_tcp *)ep; + uv_buf_t *buffers; + unsigned int buffer_count; + unsigned int i; + gpr_slice *slice; + uv_write_t *write_req; + + if (grpc_tcp_trace) { + size_t i; + + for (i = 0; i < write_slices->count; i++) { + char *data = + gpr_dump_slice(write_slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII); + gpr_log(GPR_DEBUG, "WRITE %p (peer=%s): %s", tcp, tcp->peer_string, data); + gpr_free(data); + } + } + + if (tcp->shutting_down) { + grpc_exec_ctx_sched(exec_ctx, cb, + GRPC_ERROR_CREATE("TCP socket is shutting down"), NULL); + return; + } + + GPR_ASSERT(tcp->write_cb == NULL); + tcp->write_slices = write_slices; + GPR_ASSERT(tcp->write_slices->count <= UINT_MAX); + if (tcp->write_slices->count == 0) { + // No slices means we don't have to do anything, + // and libuv doesn't like empty writes + grpc_exec_ctx_sched(exec_ctx, cb, GRPC_ERROR_NONE, NULL); + return; + } + + tcp->write_cb = cb; + buffer_count = (unsigned int)tcp->write_slices->count; + buffers = gpr_malloc(sizeof(uv_buf_t) * buffer_count); + for (i = 0; i < buffer_count; i++) { + slice = &tcp->write_slices->slices[i]; + buffers[i].base = (char *)GPR_SLICE_START_PTR(*slice); + buffers[i].len = GPR_SLICE_LENGTH(*slice); + } + write_req = gpr_malloc(sizeof(uv_write_t)); + write_req->data = tcp; + TCP_REF(tcp, "write"); + // TODO(murgatroid99): figure out what the return value here means + uv_write(write_req, (uv_stream_t *)tcp->handle, buffers, buffer_count, + write_callback); +} + +static void uv_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + grpc_pollset *pollset) { + // No-op. We're ignoring pollsets currently + (void) exec_ctx; + (void) ep; + (void) pollset; + grpc_tcp *tcp = (grpc_tcp *) ep; + tcp->pollset = pollset; +} + +static void uv_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, + grpc_pollset_set *pollset) { + // No-op. We're ignoring pollsets currently + (void) exec_ctx; + (void) ep; + (void) pollset; +} + +static void shutdown_callback(uv_shutdown_t *req, int status) { + gpr_free(req); +} + +static void uv_endpoint_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { + grpc_tcp *tcp = (grpc_tcp *)ep; + uv_shutdown_t *req = gpr_malloc(sizeof(uv_shutdown_t)); + uv_shutdown(req, (uv_stream_t *)tcp->handle, shutdown_callback); +} + +static void uv_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { + grpc_network_status_unregister_endpoint(ep); + grpc_tcp *tcp = (grpc_tcp *)ep; + gpr_log(GPR_DEBUG, "Closing uv_tcp_t handle %p", tcp->handle); + uv_close((uv_handle_t *)tcp->handle, uv_close_callback); + TCP_UNREF(tcp, "destroy"); +} + +static char *uv_get_peer(grpc_endpoint *ep) { + grpc_tcp *tcp = (grpc_tcp *)ep; + return gpr_strdup(tcp->peer_string); +} + +static grpc_workqueue *uv_get_workqueue(grpc_endpoint *ep) {return NULL; } + +static grpc_endpoint_vtable vtable = {uv_endpoint_read, + uv_endpoint_write, + uv_get_workqueue, + uv_add_to_pollset, + uv_add_to_pollset_set, + uv_endpoint_shutdown, + uv_destroy, + uv_get_peer}; + +grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle, char *peer_string) { + grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); + + if (grpc_tcp_trace) { + gpr_log(GPR_DEBUG, "Creating TCP endpoint %p", tcp); + } + + memset(tcp, 0, sizeof(grpc_tcp)); + tcp->base.vtable = &vtable; + tcp->handle = handle; + handle->data = tcp; + gpr_ref_init(&tcp->refcount, 1); + tcp->peer_string = gpr_strdup(peer_string); + /* Tell network status tracking code about the new endpoint */ + grpc_network_status_register_endpoint(&tcp->base); + +#ifndef GRPC_UV_TCP_HOLD_LOOP + uv_unref((uv_handle_t *)handle); +#endif + + return &tcp->base; +} + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/tcp_uv.h b/src/core/lib/iomgr/tcp_uv.h new file mode 100644 index 0000000000..eed41151ea --- /dev/null +++ b/src/core/lib/iomgr/tcp_uv.h @@ -0,0 +1,57 @@ +/* + * + * Copyright 2016, 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_CORE_LIB_IOMGR_TCP_UV_H +#define GRPC_CORE_LIB_IOMGR_TCP_UV_H +/* + Low level TCP "bottom half" implementation, for use by transports built on + top of a TCP connection. + + Note that this file does not (yet) include APIs for creating the socket in + the first place. + + All calls passing slice transfer ownership of a slice refcount unless + otherwise specified. +*/ + +#include "src/core/lib/iomgr/endpoint.h" + +#include + +extern int grpc_tcp_trace; + +#define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 + +grpc_endpoint *grpc_tcp_create(uv_tcp_t *handle, char *peer_string); + +#endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */ diff --git a/src/core/lib/iomgr/timer.c b/src/core/lib/iomgr/timer.c deleted file mode 100644 index 9975fa1671..0000000000 --- a/src/core/lib/iomgr/timer.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "src/core/lib/iomgr/timer.h" - -#include -#include -#include -#include "src/core/lib/iomgr/time_averaged_stats.h" -#include "src/core/lib/iomgr/timer_heap.h" - -#define INVALID_HEAP_INDEX 0xffffffffu - -#define LOG2_NUM_SHARDS 5 -#define NUM_SHARDS (1 << LOG2_NUM_SHARDS) -#define ADD_DEADLINE_SCALE 0.33 -#define MIN_QUEUE_WINDOW_DURATION 0.01 -#define MAX_QUEUE_WINDOW_DURATION 1 - -typedef struct { - gpr_mu mu; - grpc_time_averaged_stats stats; - /* All and only timers with deadlines <= this will be in the heap. */ - gpr_timespec queue_deadline_cap; - gpr_timespec min_deadline; - /* Index in the g_shard_queue */ - uint32_t shard_queue_index; - /* This holds all timers with deadlines < queue_deadline_cap. Timers in this - list have the top bit of their deadline set to 0. */ - grpc_timer_heap heap; - /* This holds timers whose deadline is >= queue_deadline_cap. */ - grpc_timer list; -} shard_type; - -/* Protects g_shard_queue */ -static gpr_mu g_mu; -/* Allow only one run_some_expired_timers at once */ -static gpr_mu g_checker_mu; -static gpr_clock_type g_clock_type; -static shard_type g_shards[NUM_SHARDS]; -/* Protected by g_mu */ -static shard_type *g_shard_queue[NUM_SHARDS]; -static bool g_initialized = false; - -static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now, - gpr_timespec *next, grpc_error *error); - -static gpr_timespec compute_min_deadline(shard_type *shard) { - return grpc_timer_heap_is_empty(&shard->heap) - ? shard->queue_deadline_cap - : grpc_timer_heap_top(&shard->heap)->deadline; -} - -void grpc_timer_list_init(gpr_timespec now) { - uint32_t i; - - g_initialized = true; - gpr_mu_init(&g_mu); - gpr_mu_init(&g_checker_mu); - g_clock_type = now.clock_type; - - for (i = 0; i < NUM_SHARDS; i++) { - shard_type *shard = &g_shards[i]; - gpr_mu_init(&shard->mu); - grpc_time_averaged_stats_init(&shard->stats, 1.0 / ADD_DEADLINE_SCALE, 0.1, - 0.5); - shard->queue_deadline_cap = now; - shard->shard_queue_index = i; - grpc_timer_heap_init(&shard->heap); - shard->list.next = shard->list.prev = &shard->list; - shard->min_deadline = compute_min_deadline(shard); - g_shard_queue[i] = shard; - } -} - -void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx) { - int i; - run_some_expired_timers(exec_ctx, gpr_inf_future(g_clock_type), NULL, - GRPC_ERROR_CREATE("Timer list shutdown")); - for (i = 0; i < NUM_SHARDS; i++) { - shard_type *shard = &g_shards[i]; - gpr_mu_destroy(&shard->mu); - grpc_timer_heap_destroy(&shard->heap); - } - gpr_mu_destroy(&g_mu); - gpr_mu_destroy(&g_checker_mu); - g_initialized = false; -} - -/* This is a cheap, but good enough, pointer hash for sharding the tasks: */ -static size_t shard_idx(const grpc_timer *info) { - size_t x = (size_t)info; - return ((x >> 4) ^ (x >> 9) ^ (x >> 14)) & (NUM_SHARDS - 1); -} - -static double ts_to_dbl(gpr_timespec ts) { - return (double)ts.tv_sec + 1e-9 * ts.tv_nsec; -} - -static gpr_timespec dbl_to_ts(double d) { - gpr_timespec ts; - ts.tv_sec = (int64_t)d; - ts.tv_nsec = (int32_t)(1e9 * (d - (double)ts.tv_sec)); - ts.clock_type = GPR_TIMESPAN; - return ts; -} - -static void list_join(grpc_timer *head, grpc_timer *timer) { - timer->next = head; - timer->prev = head->prev; - timer->next->prev = timer->prev->next = timer; -} - -static void list_remove(grpc_timer *timer) { - timer->next->prev = timer->prev; - timer->prev->next = timer->next; -} - -static void swap_adjacent_shards_in_queue(uint32_t first_shard_queue_index) { - shard_type *temp; - temp = g_shard_queue[first_shard_queue_index]; - g_shard_queue[first_shard_queue_index] = - g_shard_queue[first_shard_queue_index + 1]; - g_shard_queue[first_shard_queue_index + 1] = temp; - g_shard_queue[first_shard_queue_index]->shard_queue_index = - first_shard_queue_index; - g_shard_queue[first_shard_queue_index + 1]->shard_queue_index = - first_shard_queue_index + 1; -} - -static void note_deadline_change(shard_type *shard) { - while (shard->shard_queue_index > 0 && - gpr_time_cmp( - shard->min_deadline, - g_shard_queue[shard->shard_queue_index - 1]->min_deadline) < 0) { - swap_adjacent_shards_in_queue(shard->shard_queue_index - 1); - } - while (shard->shard_queue_index < NUM_SHARDS - 1 && - gpr_time_cmp( - shard->min_deadline, - g_shard_queue[shard->shard_queue_index + 1]->min_deadline) > 0) { - swap_adjacent_shards_in_queue(shard->shard_queue_index); - } -} - -void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, - gpr_timespec deadline, grpc_iomgr_cb_func timer_cb, - void *timer_cb_arg, gpr_timespec now) { - int is_first_timer = 0; - shard_type *shard = &g_shards[shard_idx(timer)]; - GPR_ASSERT(deadline.clock_type == g_clock_type); - GPR_ASSERT(now.clock_type == g_clock_type); - grpc_closure_init(&timer->closure, timer_cb, timer_cb_arg); - timer->deadline = deadline; - timer->triggered = 0; - - if (!g_initialized) { - timer->triggered = 1; - grpc_exec_ctx_sched( - exec_ctx, &timer->closure, - GRPC_ERROR_CREATE("Attempt to create timer before initialization"), - NULL); - return; - } - - if (gpr_time_cmp(deadline, now) <= 0) { - timer->triggered = 1; - grpc_exec_ctx_sched(exec_ctx, &timer->closure, GRPC_ERROR_NONE, NULL); - return; - } - - /* TODO(ctiller): check deadline expired */ - - gpr_mu_lock(&shard->mu); - grpc_time_averaged_stats_add_sample(&shard->stats, - ts_to_dbl(gpr_time_sub(deadline, now))); - if (gpr_time_cmp(deadline, shard->queue_deadline_cap) < 0) { - is_first_timer = grpc_timer_heap_add(&shard->heap, timer); - } else { - timer->heap_index = INVALID_HEAP_INDEX; - list_join(&shard->list, timer); - } - gpr_mu_unlock(&shard->mu); - - /* Deadline may have decreased, we need to adjust the master queue. Note - that there is a potential racy unlocked region here. There could be a - reordering of multiple grpc_timer_init calls, at this point, but the < test - below should ensure that we err on the side of caution. There could - also be a race with grpc_timer_check, which might beat us to the lock. In - that case, it is possible that the timer that we added will have already - run by the time we hold the lock, but that too is a safe error. - Finally, it's possible that the grpc_timer_check that intervened failed to - trigger the new timer because the min_deadline hadn't yet been reduced. - In that case, the timer will simply have to wait for the next - grpc_timer_check. */ - if (is_first_timer) { - gpr_mu_lock(&g_mu); - if (gpr_time_cmp(deadline, shard->min_deadline) < 0) { - gpr_timespec old_min_deadline = g_shard_queue[0]->min_deadline; - shard->min_deadline = deadline; - note_deadline_change(shard); - if (shard->shard_queue_index == 0 && - gpr_time_cmp(deadline, old_min_deadline) < 0) { - grpc_kick_poller(); - } - } - gpr_mu_unlock(&g_mu); - } -} - -void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) { - if (!g_initialized) { - /* must have already been cancelled, also the shard mutex is invalid */ - return; - } - - shard_type *shard = &g_shards[shard_idx(timer)]; - gpr_mu_lock(&shard->mu); - if (!timer->triggered) { - grpc_exec_ctx_sched(exec_ctx, &timer->closure, GRPC_ERROR_CANCELLED, NULL); - timer->triggered = 1; - if (timer->heap_index == INVALID_HEAP_INDEX) { - list_remove(timer); - } else { - grpc_timer_heap_remove(&shard->heap, timer); - } - } - gpr_mu_unlock(&shard->mu); -} - -/* This is called when the queue is empty and "now" has reached the - queue_deadline_cap. We compute a new queue deadline and then scan the map - for timers that fall at or under it. Returns true if the queue is no - longer empty. - REQUIRES: shard->mu locked */ -static int refill_queue(shard_type *shard, gpr_timespec now) { - /* Compute the new queue window width and bound by the limits: */ - double computed_deadline_delta = - grpc_time_averaged_stats_update_average(&shard->stats) * - ADD_DEADLINE_SCALE; - double deadline_delta = - GPR_CLAMP(computed_deadline_delta, MIN_QUEUE_WINDOW_DURATION, - MAX_QUEUE_WINDOW_DURATION); - grpc_timer *timer, *next; - - /* Compute the new cap and put all timers under it into the queue: */ - shard->queue_deadline_cap = gpr_time_add( - gpr_time_max(now, shard->queue_deadline_cap), dbl_to_ts(deadline_delta)); - for (timer = shard->list.next; timer != &shard->list; timer = next) { - next = timer->next; - - if (gpr_time_cmp(timer->deadline, shard->queue_deadline_cap) < 0) { - list_remove(timer); - grpc_timer_heap_add(&shard->heap, timer); - } - } - return !grpc_timer_heap_is_empty(&shard->heap); -} - -/* This pops the next non-cancelled timer with deadline <= now from the - queue, or returns NULL if there isn't one. - REQUIRES: shard->mu locked */ -static grpc_timer *pop_one(shard_type *shard, gpr_timespec now) { - grpc_timer *timer; - for (;;) { - if (grpc_timer_heap_is_empty(&shard->heap)) { - if (gpr_time_cmp(now, shard->queue_deadline_cap) < 0) return NULL; - if (!refill_queue(shard, now)) return NULL; - } - timer = grpc_timer_heap_top(&shard->heap); - if (gpr_time_cmp(timer->deadline, now) > 0) return NULL; - timer->triggered = 1; - grpc_timer_heap_pop(&shard->heap); - return timer; - } -} - -/* REQUIRES: shard->mu unlocked */ -static size_t pop_timers(grpc_exec_ctx *exec_ctx, shard_type *shard, - gpr_timespec now, gpr_timespec *new_min_deadline, - grpc_error *error) { - size_t n = 0; - grpc_timer *timer; - gpr_mu_lock(&shard->mu); - while ((timer = pop_one(shard, now))) { - grpc_exec_ctx_sched(exec_ctx, &timer->closure, GRPC_ERROR_REF(error), NULL); - n++; - } - *new_min_deadline = compute_min_deadline(shard); - gpr_mu_unlock(&shard->mu); - return n; -} - -static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now, - gpr_timespec *next, grpc_error *error) { - size_t n = 0; - - /* TODO(ctiller): verify that there are any timers (atomically) here */ - - if (gpr_mu_trylock(&g_checker_mu)) { - gpr_mu_lock(&g_mu); - - while (gpr_time_cmp(g_shard_queue[0]->min_deadline, now) < 0) { - gpr_timespec new_min_deadline; - - /* For efficiency, we pop as many available timers as we can from the - shard. This may violate perfect timer deadline ordering, but that - shouldn't be a big deal because we don't make ordering guarantees. */ - n += - pop_timers(exec_ctx, g_shard_queue[0], now, &new_min_deadline, error); - - /* An grpc_timer_init() on the shard could intervene here, adding a new - timer that is earlier than new_min_deadline. However, - grpc_timer_init() will block on the master_lock before it can call - set_min_deadline, so this one will complete first and then the Addtimer - will reduce the min_deadline (perhaps unnecessarily). */ - g_shard_queue[0]->min_deadline = new_min_deadline; - note_deadline_change(g_shard_queue[0]); - } - - if (next) { - *next = gpr_time_min(*next, g_shard_queue[0]->min_deadline); - } - - gpr_mu_unlock(&g_mu); - gpr_mu_unlock(&g_checker_mu); - } else if (next != NULL) { - /* TODO(ctiller): this forces calling code to do an short poll, and - then retry the timer check (because this time through the timer list was - contended). - - We could reduce the cost here dramatically by keeping a count of how many - currently active pollers got through the uncontended case above - successfully, and waking up other pollers IFF that count drops to zero. - - Once that count is in place, this entire else branch could disappear. */ - *next = gpr_time_min( - *next, gpr_time_add(now, gpr_time_from_millis(1, GPR_TIMESPAN))); - } - - GRPC_ERROR_UNREF(error); - - return (int)n; -} - -bool grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now, - gpr_timespec *next) { - GPR_ASSERT(now.clock_type == g_clock_type); - return run_some_expired_timers( - exec_ctx, now, next, - gpr_time_cmp(now, gpr_inf_future(now.clock_type)) != 0 - ? GRPC_ERROR_NONE - : GRPC_ERROR_CREATE("Shutting down timer system")); -} diff --git a/src/core/lib/iomgr/timer.h b/src/core/lib/iomgr/timer.h index a825d2a28b..b76ba079c4 100644 --- a/src/core/lib/iomgr/timer.h +++ b/src/core/lib/iomgr/timer.h @@ -34,19 +34,20 @@ #ifndef GRPC_CORE_LIB_IOMGR_TIMER_H #define GRPC_CORE_LIB_IOMGR_TIMER_H +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV +#include "src/core/lib/iomgr/timer_uv.h" +#else +#include "src/core/lib/iomgr/timer_generic.h" +#endif /* GRPC_UV */ + #include #include #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/iomgr.h" -typedef struct grpc_timer { - gpr_timespec deadline; - uint32_t heap_index; /* INVALID_HEAP_INDEX if not in heap */ - int triggered; - struct grpc_timer *next; - struct grpc_timer *prev; - grpc_closure closure; -} grpc_timer; +typedef struct grpc_timer grpc_timer; /* Initialize *timer. When expired or canceled, timer_cb will be called with *timer_cb_arg and status to indicate if it expired (SUCCESS) or was diff --git a/src/core/lib/iomgr/timer_generic.c b/src/core/lib/iomgr/timer_generic.c new file mode 100644 index 0000000000..00058f9d86 --- /dev/null +++ b/src/core/lib/iomgr/timer_generic.c @@ -0,0 +1,390 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_TIMER_USE_GENERIC + +#include "src/core/lib/iomgr/timer.h" + +#include +#include +#include +#include "src/core/lib/iomgr/time_averaged_stats.h" +#include "src/core/lib/iomgr/timer_heap.h" + +#define INVALID_HEAP_INDEX 0xffffffffu + +#define LOG2_NUM_SHARDS 5 +#define NUM_SHARDS (1 << LOG2_NUM_SHARDS) +#define ADD_DEADLINE_SCALE 0.33 +#define MIN_QUEUE_WINDOW_DURATION 0.01 +#define MAX_QUEUE_WINDOW_DURATION 1 + +typedef struct { + gpr_mu mu; + grpc_time_averaged_stats stats; + /* All and only timers with deadlines <= this will be in the heap. */ + gpr_timespec queue_deadline_cap; + gpr_timespec min_deadline; + /* Index in the g_shard_queue */ + uint32_t shard_queue_index; + /* This holds all timers with deadlines < queue_deadline_cap. Timers in this + list have the top bit of their deadline set to 0. */ + grpc_timer_heap heap; + /* This holds timers whose deadline is >= queue_deadline_cap. */ + grpc_timer list; +} shard_type; + +/* Protects g_shard_queue */ +static gpr_mu g_mu; +/* Allow only one run_some_expired_timers at once */ +static gpr_mu g_checker_mu; +static gpr_clock_type g_clock_type; +static shard_type g_shards[NUM_SHARDS]; +/* Protected by g_mu */ +static shard_type *g_shard_queue[NUM_SHARDS]; +static bool g_initialized = false; + +static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now, + gpr_timespec *next, grpc_error *error); + +static gpr_timespec compute_min_deadline(shard_type *shard) { + return grpc_timer_heap_is_empty(&shard->heap) + ? shard->queue_deadline_cap + : grpc_timer_heap_top(&shard->heap)->deadline; +} + +void grpc_timer_list_init(gpr_timespec now) { + uint32_t i; + + g_initialized = true; + gpr_mu_init(&g_mu); + gpr_mu_init(&g_checker_mu); + g_clock_type = now.clock_type; + + for (i = 0; i < NUM_SHARDS; i++) { + shard_type *shard = &g_shards[i]; + gpr_mu_init(&shard->mu); + grpc_time_averaged_stats_init(&shard->stats, 1.0 / ADD_DEADLINE_SCALE, 0.1, + 0.5); + shard->queue_deadline_cap = now; + shard->shard_queue_index = i; + grpc_timer_heap_init(&shard->heap); + shard->list.next = shard->list.prev = &shard->list; + shard->min_deadline = compute_min_deadline(shard); + g_shard_queue[i] = shard; + } +} + +void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx) { + int i; + run_some_expired_timers(exec_ctx, gpr_inf_future(g_clock_type), NULL, + GRPC_ERROR_CREATE("Timer list shutdown")); + for (i = 0; i < NUM_SHARDS; i++) { + shard_type *shard = &g_shards[i]; + gpr_mu_destroy(&shard->mu); + grpc_timer_heap_destroy(&shard->heap); + } + gpr_mu_destroy(&g_mu); + gpr_mu_destroy(&g_checker_mu); + g_initialized = false; +} + +/* This is a cheap, but good enough, pointer hash for sharding the tasks: */ +static size_t shard_idx(const grpc_timer *info) { + size_t x = (size_t)info; + return ((x >> 4) ^ (x >> 9) ^ (x >> 14)) & (NUM_SHARDS - 1); +} + +static double ts_to_dbl(gpr_timespec ts) { + return (double)ts.tv_sec + 1e-9 * ts.tv_nsec; +} + +static gpr_timespec dbl_to_ts(double d) { + gpr_timespec ts; + ts.tv_sec = (int64_t)d; + ts.tv_nsec = (int32_t)(1e9 * (d - (double)ts.tv_sec)); + ts.clock_type = GPR_TIMESPAN; + return ts; +} + +static void list_join(grpc_timer *head, grpc_timer *timer) { + timer->next = head; + timer->prev = head->prev; + timer->next->prev = timer->prev->next = timer; +} + +static void list_remove(grpc_timer *timer) { + timer->next->prev = timer->prev; + timer->prev->next = timer->next; +} + +static void swap_adjacent_shards_in_queue(uint32_t first_shard_queue_index) { + shard_type *temp; + temp = g_shard_queue[first_shard_queue_index]; + g_shard_queue[first_shard_queue_index] = + g_shard_queue[first_shard_queue_index + 1]; + g_shard_queue[first_shard_queue_index + 1] = temp; + g_shard_queue[first_shard_queue_index]->shard_queue_index = + first_shard_queue_index; + g_shard_queue[first_shard_queue_index + 1]->shard_queue_index = + first_shard_queue_index + 1; +} + +static void note_deadline_change(shard_type *shard) { + while (shard->shard_queue_index > 0 && + gpr_time_cmp( + shard->min_deadline, + g_shard_queue[shard->shard_queue_index - 1]->min_deadline) < 0) { + swap_adjacent_shards_in_queue(shard->shard_queue_index - 1); + } + while (shard->shard_queue_index < NUM_SHARDS - 1 && + gpr_time_cmp( + shard->min_deadline, + g_shard_queue[shard->shard_queue_index + 1]->min_deadline) > 0) { + swap_adjacent_shards_in_queue(shard->shard_queue_index); + } +} + +void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, + gpr_timespec deadline, grpc_iomgr_cb_func timer_cb, + void *timer_cb_arg, gpr_timespec now) { + int is_first_timer = 0; + shard_type *shard = &g_shards[shard_idx(timer)]; + GPR_ASSERT(deadline.clock_type == g_clock_type); + GPR_ASSERT(now.clock_type == g_clock_type); + grpc_closure_init(&timer->closure, timer_cb, timer_cb_arg); + timer->deadline = deadline; + timer->triggered = 0; + + if (!g_initialized) { + timer->triggered = 1; + grpc_exec_ctx_sched( + exec_ctx, &timer->closure, + GRPC_ERROR_CREATE("Attempt to create timer before initialization"), + NULL); + return; + } + + if (gpr_time_cmp(deadline, now) <= 0) { + timer->triggered = 1; + grpc_exec_ctx_sched(exec_ctx, &timer->closure, GRPC_ERROR_NONE, NULL); + return; + } + + /* TODO(ctiller): check deadline expired */ + + gpr_mu_lock(&shard->mu); + grpc_time_averaged_stats_add_sample(&shard->stats, + ts_to_dbl(gpr_time_sub(deadline, now))); + if (gpr_time_cmp(deadline, shard->queue_deadline_cap) < 0) { + is_first_timer = grpc_timer_heap_add(&shard->heap, timer); + } else { + timer->heap_index = INVALID_HEAP_INDEX; + list_join(&shard->list, timer); + } + gpr_mu_unlock(&shard->mu); + + /* Deadline may have decreased, we need to adjust the master queue. Note + that there is a potential racy unlocked region here. There could be a + reordering of multiple grpc_timer_init calls, at this point, but the < test + below should ensure that we err on the side of caution. There could + also be a race with grpc_timer_check, which might beat us to the lock. In + that case, it is possible that the timer that we added will have already + run by the time we hold the lock, but that too is a safe error. + Finally, it's possible that the grpc_timer_check that intervened failed to + trigger the new timer because the min_deadline hadn't yet been reduced. + In that case, the timer will simply have to wait for the next + grpc_timer_check. */ + if (is_first_timer) { + gpr_mu_lock(&g_mu); + if (gpr_time_cmp(deadline, shard->min_deadline) < 0) { + gpr_timespec old_min_deadline = g_shard_queue[0]->min_deadline; + shard->min_deadline = deadline; + note_deadline_change(shard); + if (shard->shard_queue_index == 0 && + gpr_time_cmp(deadline, old_min_deadline) < 0) { + grpc_kick_poller(); + } + } + gpr_mu_unlock(&g_mu); + } +} + +void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) { + if (!g_initialized) { + /* must have already been cancelled, also the shard mutex is invalid */ + return; + } + + shard_type *shard = &g_shards[shard_idx(timer)]; + gpr_mu_lock(&shard->mu); + if (!timer->triggered) { + grpc_exec_ctx_sched(exec_ctx, &timer->closure, GRPC_ERROR_CANCELLED, NULL); + timer->triggered = 1; + if (timer->heap_index == INVALID_HEAP_INDEX) { + list_remove(timer); + } else { + grpc_timer_heap_remove(&shard->heap, timer); + } + } + gpr_mu_unlock(&shard->mu); +} + +/* This is called when the queue is empty and "now" has reached the + queue_deadline_cap. We compute a new queue deadline and then scan the map + for timers that fall at or under it. Returns true if the queue is no + longer empty. + REQUIRES: shard->mu locked */ +static int refill_queue(shard_type *shard, gpr_timespec now) { + /* Compute the new queue window width and bound by the limits: */ + double computed_deadline_delta = + grpc_time_averaged_stats_update_average(&shard->stats) * + ADD_DEADLINE_SCALE; + double deadline_delta = + GPR_CLAMP(computed_deadline_delta, MIN_QUEUE_WINDOW_DURATION, + MAX_QUEUE_WINDOW_DURATION); + grpc_timer *timer, *next; + + /* Compute the new cap and put all timers under it into the queue: */ + shard->queue_deadline_cap = gpr_time_add( + gpr_time_max(now, shard->queue_deadline_cap), dbl_to_ts(deadline_delta)); + for (timer = shard->list.next; timer != &shard->list; timer = next) { + next = timer->next; + + if (gpr_time_cmp(timer->deadline, shard->queue_deadline_cap) < 0) { + list_remove(timer); + grpc_timer_heap_add(&shard->heap, timer); + } + } + return !grpc_timer_heap_is_empty(&shard->heap); +} + +/* This pops the next non-cancelled timer with deadline <= now from the + queue, or returns NULL if there isn't one. + REQUIRES: shard->mu locked */ +static grpc_timer *pop_one(shard_type *shard, gpr_timespec now) { + grpc_timer *timer; + for (;;) { + if (grpc_timer_heap_is_empty(&shard->heap)) { + if (gpr_time_cmp(now, shard->queue_deadline_cap) < 0) return NULL; + if (!refill_queue(shard, now)) return NULL; + } + timer = grpc_timer_heap_top(&shard->heap); + if (gpr_time_cmp(timer->deadline, now) > 0) return NULL; + timer->triggered = 1; + grpc_timer_heap_pop(&shard->heap); + return timer; + } +} + +/* REQUIRES: shard->mu unlocked */ +static size_t pop_timers(grpc_exec_ctx *exec_ctx, shard_type *shard, + gpr_timespec now, gpr_timespec *new_min_deadline, + grpc_error *error) { + size_t n = 0; + grpc_timer *timer; + gpr_mu_lock(&shard->mu); + while ((timer = pop_one(shard, now))) { + grpc_exec_ctx_sched(exec_ctx, &timer->closure, GRPC_ERROR_REF(error), NULL); + n++; + } + *new_min_deadline = compute_min_deadline(shard); + gpr_mu_unlock(&shard->mu); + return n; +} + +static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now, + gpr_timespec *next, grpc_error *error) { + size_t n = 0; + + /* TODO(ctiller): verify that there are any timers (atomically) here */ + + if (gpr_mu_trylock(&g_checker_mu)) { + gpr_mu_lock(&g_mu); + + while (gpr_time_cmp(g_shard_queue[0]->min_deadline, now) < 0) { + gpr_timespec new_min_deadline; + + /* For efficiency, we pop as many available timers as we can from the + shard. This may violate perfect timer deadline ordering, but that + shouldn't be a big deal because we don't make ordering guarantees. */ + n += + pop_timers(exec_ctx, g_shard_queue[0], now, &new_min_deadline, error); + + /* An grpc_timer_init() on the shard could intervene here, adding a new + timer that is earlier than new_min_deadline. However, + grpc_timer_init() will block on the master_lock before it can call + set_min_deadline, so this one will complete first and then the Addtimer + will reduce the min_deadline (perhaps unnecessarily). */ + g_shard_queue[0]->min_deadline = new_min_deadline; + note_deadline_change(g_shard_queue[0]); + } + + if (next) { + *next = gpr_time_min(*next, g_shard_queue[0]->min_deadline); + } + + gpr_mu_unlock(&g_mu); + gpr_mu_unlock(&g_checker_mu); + } else if (next != NULL) { + /* TODO(ctiller): this forces calling code to do an short poll, and + then retry the timer check (because this time through the timer list was + contended). + + We could reduce the cost here dramatically by keeping a count of how many + currently active pollers got through the uncontended case above + successfully, and waking up other pollers IFF that count drops to zero. + + Once that count is in place, this entire else branch could disappear. */ + *next = gpr_time_min( + *next, gpr_time_add(now, gpr_time_from_millis(1, GPR_TIMESPAN))); + } + + GRPC_ERROR_UNREF(error); + + return (int)n; +} + +bool grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now, + gpr_timespec *next) { + GPR_ASSERT(now.clock_type == g_clock_type); + return run_some_expired_timers( + exec_ctx, now, next, + gpr_time_cmp(now, gpr_inf_future(now.clock_type)) != 0 + ? GRPC_ERROR_NONE + : GRPC_ERROR_CREATE("Shutting down timer system")); +} + +#endif /* GRPC_TIMER_USE_GENERIC */ diff --git a/src/core/lib/iomgr/timer_generic.h b/src/core/lib/iomgr/timer_generic.h new file mode 100644 index 0000000000..e4494adb5f --- /dev/null +++ b/src/core/lib/iomgr/timer_generic.h @@ -0,0 +1,49 @@ +/* + * + * Copyright 2016, 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_CORE_LIB_IOMGR_TIMER_GENERIC_H +#define GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H + +#include +#include "src/core/lib/iomgr/exec_ctx.h" + +struct grpc_timer { + gpr_timespec deadline; + uint32_t heap_index; /* INVALID_HEAP_INDEX if not in heap */ + int triggered; + struct grpc_timer *next; + struct grpc_timer *prev; + grpc_closure closure; +}; + +#endif /* GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H */ diff --git a/src/core/lib/iomgr/timer_heap.c b/src/core/lib/iomgr/timer_heap.c index 2ad9bb9cd2..f736d335e6 100644 --- a/src/core/lib/iomgr/timer_heap.c +++ b/src/core/lib/iomgr/timer_heap.c @@ -31,6 +31,10 @@ * */ +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_TIMER_USE_GENERIC + #include "src/core/lib/iomgr/timer_heap.h" #include @@ -144,3 +148,5 @@ grpc_timer *grpc_timer_heap_top(grpc_timer_heap *heap) { void grpc_timer_heap_pop(grpc_timer_heap *heap) { grpc_timer_heap_remove(heap, grpc_timer_heap_top(heap)); } + +#endif /* GRPC_TIMER_USE_GENERIC */ diff --git a/src/core/lib/iomgr/timer_uv.c b/src/core/lib/iomgr/timer_uv.c new file mode 100644 index 0000000000..ffeb08cb79 --- /dev/null +++ b/src/core/lib/iomgr/timer_uv.c @@ -0,0 +1,103 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#if GRPC_UV + +#include +#include + +#include "src/core/lib/iomgr/timer.h" + +#include + +static void timer_close_callback(uv_handle_t *handle) { + gpr_free(handle); +} + +static void stop_uv_timer(uv_timer_t *handle) { + uv_timer_stop(handle); + uv_unref((uv_handle_t*) handle); + gpr_log(GPR_DEBUG, "Closing uv_timer_t handle %p", handle); + uv_close((uv_handle_t*) handle, timer_close_callback); +} + +void run_expired_timer(uv_timer_t *handle) { + grpc_timer *timer = (grpc_timer*)handle->data; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + gpr_log(GPR_DEBUG, "Timer callback: %p", timer); + GPR_ASSERT(!timer->triggered); + timer->triggered = 1; + grpc_exec_ctx_sched(&exec_ctx, &timer->closure, GRPC_ERROR_NONE, NULL); + stop_uv_timer(handle); + grpc_exec_ctx_finish(&exec_ctx); +} + +void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, + gpr_timespec deadline, grpc_iomgr_cb_func timer_cb, + void *timer_cb_arg, gpr_timespec now) { + uint64_t timeout; + grpc_closure_init(&timer->closure, timer_cb, timer_cb_arg); + if (gpr_time_cmp(deadline, now) <= 0) { + timer->triggered = 1; + grpc_exec_ctx_sched(exec_ctx, &timer->closure, GRPC_ERROR_NONE, NULL); + return; + } + timer->triggered = 0; + timeout = (uint64_t)gpr_time_to_millis(gpr_time_sub(deadline, now)); + gpr_log(GPR_DEBUG, "Setting timer %p: %lu", timer, timeout); + timer->uv_timer = gpr_malloc(sizeof(uv_timer_t)); + uv_timer_init(uv_default_loop(), timer->uv_timer); + timer->uv_timer->data = timer; + uv_timer_start(timer->uv_timer, run_expired_timer, timeout, 0); +} + +void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) { + if (!timer->triggered) { + gpr_log(GPR_DEBUG, "Running cancelled timer callback"); + timer->triggered = 1; + grpc_exec_ctx_sched(exec_ctx, &timer->closure, GRPC_ERROR_CANCELLED, NULL); + stop_uv_timer(timer->uv_timer); + } +} + +bool grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now, + gpr_timespec *next) { + return false; +} + +void grpc_timer_list_init(gpr_timespec now) {} +void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx) {} + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/timer_uv.h b/src/core/lib/iomgr/timer_uv.h new file mode 100644 index 0000000000..d78d6a6ca2 --- /dev/null +++ b/src/core/lib/iomgr/timer_uv.h @@ -0,0 +1,47 @@ +/* + * + * Copyright 2016, 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_CORE_LIB_IOMGR_TIMER_GENERIC_H +#define GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H + +#include + +#include "src/core/lib/iomgr/exec_ctx.h" + +struct grpc_timer { + grpc_closure closure; + uv_timer_t *uv_timer; + int triggered; +}; + +#endif /* GRPC_CORE_LIB_IOMGR_TIMER_GENERIC_H */ diff --git a/src/core/lib/iomgr/workqueue_uv.c b/src/core/lib/iomgr/workqueue_uv.c new file mode 100644 index 0000000000..5e4eb504ac --- /dev/null +++ b/src/core/lib/iomgr/workqueue_uv.c @@ -0,0 +1,62 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include "src/core/lib/iomgr/workqueue.h" + +// Minimal implementation of grpc_workqueue for libuv +// Works by directly enqueuing workqueue items onto the current execution +// context, which is at least correct, if not performant or in the spirit of +// workqueues. + +void grpc_workqueue_flush(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue) {} + +#ifdef GRPC_WORKQUEUE_REFCOUNT_DEBUG +void grpc_workqueue_ref(grpc_workqueue *workqueue, const char *file, int line, + const char *reason) {} +void grpc_workqueue_unref(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue, + const char *file, int line, const char *reason) {} +#else +void grpc_workqueue_ref(grpc_workqueue *workqueue) {} +void grpc_workqueue_unref(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue) {} +#endif + +void grpc_workqueue_enqueue(grpc_exec_ctx *exec_ctx, grpc_workqueue *workqueue, + grpc_closure *closure, grpc_error *error) { + grpc_exec_ctx_sched(exec_ctx, closure, error, NULL); +} + +#endif /* GPR_UV */ diff --git a/src/core/lib/iomgr/workqueue_uv.h b/src/core/lib/iomgr/workqueue_uv.h new file mode 100644 index 0000000000..be3f8e4d93 --- /dev/null +++ b/src/core/lib/iomgr/workqueue_uv.h @@ -0,0 +1,37 @@ +/* + * + * Copyright 2016, 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_CORE_LIB_IOMGR_WORKQUEUE_UV_H +#define GRPC_CORE_LIB_IOMGR_WORKQUEUE_UV_H + +#endif /* GRPC_CORE_LIB_IOMGR_WORKQUEUE_UV_H */ diff --git a/src/core/lib/security/context/security_context.c b/src/core/lib/security/context/security_context.c index 127b13ee50..874cc05455 100644 --- a/src/core/lib/security/context/security_context.c +++ b/src/core/lib/security/context/security_context.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include "src/core/lib/security/context/security_context.h" diff --git a/src/core/lib/security/context/security_context.h b/src/core/lib/security/context/security_context.h index 4e7666dfe3..b48d1d0ab7 100644 --- a/src/core/lib/security/context/security_context.h +++ b/src/core/lib/security/context/security_context.h @@ -34,6 +34,11 @@ #ifndef GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H #define GRPC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/security/credentials/credentials.h" diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h index 8e9d842ead..bfdfcb6761 100644 --- a/src/core/lib/security/credentials/credentials.h +++ b/src/core/lib/security/credentials/credentials.h @@ -34,6 +34,11 @@ #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include #include diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c index c22ea5c468..e9638c5a22 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h" #include diff --git a/src/core/lib/security/transport/server_auth_filter.c b/src/core/lib/security/transport/server_auth_filter.c index def16c8229..3339c0a3be 100644 --- a/src/core/lib/security/transport/server_auth_filter.c +++ b/src/core/lib/security/transport/server_auth_filter.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include "src/core/lib/security/context/security_context.h" diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 772681109a..6a38b4b427 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -30,6 +30,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include #include #include diff --git a/src/core/lib/surface/init_secure.c b/src/core/lib/surface/init_secure.c index 7ee7b51568..9a9342ff2c 100644 --- a/src/core/lib/surface/init_secure.c +++ b/src/core/lib/surface/init_secure.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include "src/core/lib/surface/init.h" #include diff --git a/src/core/lib/tsi/ssl_transport_security.c b/src/core/lib/tsi/ssl_transport_security.c index f6e8c518e3..116b66a179 100644 --- a/src/core/lib/tsi/ssl_transport_security.c +++ b/src/core/lib/tsi/ssl_transport_security.c @@ -31,6 +31,11 @@ * */ +/* We currently need this at the top of the file if we import some iomgr + headers because if we are building with libuv, those headers will include + uv.h, which needs to be included before other system headers */ +#include "src/core/lib/iomgr/port.h" + #include "src/core/lib/tsi/ssl_transport_security.h" #include "src/core/lib/iomgr/socket_utils.h" diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 9f023b5883..b48a7bd698 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -45,6 +45,7 @@ #include "byte_buffer.h" #include "call.h" #include "channel.h" +#include "completion_queue.h" #include "completion_queue_async_worker.h" #include "call_credentials.h" #include "timeval.h" @@ -222,6 +223,9 @@ class SendMetadataOp : public Op { out->data.send_initial_metadata.metadata = array.metadata; return true; } + bool IsFinalOp() { + return false; + } protected: std::string GetTypeString() const { return "send_metadata"; @@ -263,6 +267,9 @@ class SendMessageOp : public Op { resources->handles.push_back(unique_ptr(handle)); return true; } + bool IsFinalOp() { + return false; + } protected: std::string GetTypeString() const { return "send_message"; @@ -281,6 +288,9 @@ class SendClientCloseOp : public Op { shared_ptr resources) { return true; } + bool IsFinalOp() { + return false; + } protected: std::string GetTypeString() const { return "client_close"; @@ -341,6 +351,9 @@ class SendServerStatusOp : public Op { out->data.send_status_from_server.status_details = **str; return true; } + bool IsFinalOp() { + return true; + } protected: std::string GetTypeString() const { return "send_status"; @@ -367,6 +380,9 @@ class GetMetadataOp : public Op { out->data.recv_initial_metadata = &recv_metadata; return true; } + bool IsFinalOp() { + return false; + } protected: std::string GetTypeString() const { @@ -397,6 +413,9 @@ class ReadMessageOp : public Op { out->data.recv_message = &recv_message; return true; } + bool IsFinalOp() { + return false; + } protected: std::string GetTypeString() const { @@ -442,6 +461,9 @@ class ClientStatusOp : public Op { ParseMetadata(&metadata_array)); return scope.Escape(status_obj); } + bool IsFinalOp() { + return true; + } protected: std::string GetTypeString() const { return "status"; @@ -465,6 +487,9 @@ class ServerCloseResponseOp : public Op { out->data.recv_close_on_server.cancelled = &cancelled; return true; } + bool IsFinalOp() { + return false; + } protected: std::string GetTypeString() const { @@ -476,8 +501,8 @@ class ServerCloseResponseOp : public Op { }; tag::tag(Callback *callback, OpVec *ops, - shared_ptr resources) : - callback(callback), ops(ops), resources(resources){ + shared_ptr resources, Call *call) : + callback(callback), ops(ops), resources(resources), call(call){ } tag::~tag() { @@ -502,16 +527,36 @@ Callback *GetTagCallback(void *tag) { return tag_struct->callback; } +void CompleteTag(void *tag) { + struct tag *tag_struct = reinterpret_cast(tag); + bool is_final_op = false; + if (tag_struct->call == NULL) { + return; + } + for (vector >::iterator it = tag_struct->ops->begin(); + it != tag_struct->ops->end(); ++it) { + Op *op_ptr = it->get(); + if (op_ptr->IsFinalOp()) { + is_final_op = true; + } + } + tag_struct->call->CompleteBatch(is_final_op); +} + void DestroyTag(void *tag) { struct tag *tag_struct = reinterpret_cast(tag); delete tag_struct; } -Call::Call(grpc_call *call) : wrapped_call(call) { +Call::Call(grpc_call *call) : wrapped_call(call), + pending_batches(0), + has_final_op_completed(false) { } Call::~Call() { - grpc_call_destroy(wrapped_call); + if (wrapped_call != NULL) { + grpc_call_destroy(wrapped_call); + } } void Call::Init(Local exports) { @@ -552,6 +597,17 @@ Local Call::WrapStruct(grpc_call *call) { } } +void Call::CompleteBatch(bool is_final_op) { + if (is_final_op) { + this->has_final_op_completed = true; + } + this->pending_batches--; + if (this->has_final_op_completed && this->pending_batches == 0) { + grpc_call_destroy(this->wrapped_call); + this->wrapped_call = NULL; + } +} + NAN_METHOD(Call::New) { if (info.IsConstructCall()) { Call *call; @@ -602,12 +658,12 @@ NAN_METHOD(Call::New) { Utf8String host_override(info[3]); wrapped_call = grpc_channel_create_call( wrapped_channel, parent_call, propagate_flags, - CompletionQueueAsyncWorker::GetQueue(), *method, + GetCompletionQueue(), *method, *host_override, MillisecondsToTimespec(deadline), NULL); } else if (info[3]->IsUndefined() || info[3]->IsNull()) { wrapped_call = grpc_channel_create_call( wrapped_channel, parent_call, propagate_flags, - CompletionQueueAsyncWorker::GetQueue(), *method, + GetCompletionQueue(), *method, NULL, MillisecondsToTimespec(deadline), NULL); } else { return Nan::ThrowTypeError("Call's fourth argument must be a string"); @@ -697,11 +753,12 @@ NAN_METHOD(Call::StartBatch) { Callback *callback = new Callback(callback_func); grpc_call_error error = grpc_call_start_batch( call->wrapped_call, &ops[0], nops, new struct tag( - callback, op_vector.release(), resources), NULL); + callback, op_vector.release(), resources, call), NULL); if (error != GRPC_CALL_OK) { return Nan::ThrowError(nanErrorWithCode("startBatch failed", error)); } - CompletionQueueAsyncWorker::Next(); + call->pending_batches++; + CompletionQueueNext(); } NAN_METHOD(Call::Cancel) { diff --git a/src/node/ext/call.h b/src/node/ext/call.h index 1e3c3ba18d..31c6566d14 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -66,34 +66,6 @@ bool CreateMetadataArray(v8::Local metadata, grpc_metadata_array *array, shared_ptr resources); -class Op { - public: - virtual v8::Local GetNodeValue() const = 0; - virtual bool ParseOp(v8::Local value, grpc_op *out, - shared_ptr resources) = 0; - virtual ~Op(); - v8::Local GetOpType() const; - - protected: - virtual std::string GetTypeString() const = 0; -}; - -typedef std::vector> OpVec; -struct tag { - tag(Nan::Callback *callback, OpVec *ops, - shared_ptr resources); - ~tag(); - Nan::Callback *callback; - OpVec *ops; - shared_ptr resources; -}; - -v8::Local GetTagNodeValue(void *tag); - -Nan::Callback *GetTagCallback(void *tag); - -void DestroyTag(void *tag); - /* Wrapper class for grpc_call structs. */ class Call : public Nan::ObjectWrap { public: @@ -102,6 +74,8 @@ class Call : public Nan::ObjectWrap { /* Wrap a grpc_call struct in a javascript object */ static v8::Local WrapStruct(grpc_call *call); + void CompleteBatch(bool is_final_op); + private: explicit Call(grpc_call *call); ~Call(); @@ -121,8 +95,46 @@ class Call : public Nan::ObjectWrap { static Nan::Persistent fun_tpl; grpc_call *wrapped_call; + // The number of ops that were started but not completed on this call + int pending_batches; + /* Indicates whether the "final" op on a call has completed. For a client + call, this is GRPC_OP_RECV_STATUS_ON_CLIENT and for a server call, this + is GRPC_OP_SEND_STATUS_FROM_SERVER */ + bool has_final_op_completed; }; +class Op { + public: + virtual v8::Local GetNodeValue() const = 0; + virtual bool ParseOp(v8::Local value, grpc_op *out, + shared_ptr resources) = 0; + virtual ~Op(); + v8::Local GetOpType() const; + virtual bool IsFinalOp() = 0; + + protected: + virtual std::string GetTypeString() const = 0; +}; + +typedef std::vector> OpVec; +struct tag { + tag(Nan::Callback *callback, OpVec *ops, + shared_ptr resources, Call *call); + ~tag(); + Nan::Callback *callback; + OpVec *ops; + shared_ptr resources; + Call *call; +}; + +v8::Local GetTagNodeValue(void *tag); + +Nan::Callback *GetTagCallback(void *tag); + +void DestroyTag(void *tag); + +void CompleteTag(void *tag); + } // namespace node } // namespace grpc diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc index 00fcca6dc8..c4028170e7 100644 --- a/src/node/ext/channel.cc +++ b/src/node/ext/channel.cc @@ -41,6 +41,7 @@ #include "grpc/grpc_security.h" #include "call.h" #include "channel.h" +#include "completion_queue.h" #include "completion_queue_async_worker.h" #include "channel_credentials.h" #include "timeval.h" @@ -140,6 +141,7 @@ void DeallocateChannelArgs(grpc_channel_args *channel_args) { Channel::Channel(grpc_channel *channel) : wrapped_channel(channel) {} Channel::~Channel() { + gpr_log(GPR_DEBUG, "Destroying channel"); if (wrapped_channel != NULL) { grpc_channel_destroy(wrapped_channel); } @@ -276,11 +278,11 @@ NAN_METHOD(Channel::WatchConnectivityState) { unique_ptr ops(new OpVec()); grpc_channel_watch_connectivity_state( channel->wrapped_channel, last_state, MillisecondsToTimespec(deadline), - CompletionQueueAsyncWorker::GetQueue(), + GetCompletionQueue(), new struct tag(callback, ops.release(), - shared_ptr(nullptr))); - CompletionQueueAsyncWorker::Next(); + shared_ptr(nullptr), NULL)); + CompletionQueueNext(); } } // namespace node diff --git a/src/node/ext/completion_queue.cc b/src/node/ext/completion_queue.cc new file mode 100644 index 0000000000..fcfa77b39c --- /dev/null +++ b/src/node/ext/completion_queue.cc @@ -0,0 +1,114 @@ +/* + * + * Copyright 2016, 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 +#include +#include +#include + +#include "call.h" +#include "completion_queue.h" +#include "completion_queue_async_worker.h" + +namespace grpc { +namespace node { + +using v8::Local; +using v8::Object; +using v8::Value; + +grpc_completion_queue *queue; +uv_prepare_t prepare; +int pending_batches; + +void drain_completion_queue(uv_prepare_t *handle) { + Nan::HandleScope scope; + grpc_event event; + (void)handle; + do { + event = grpc_completion_queue_next( + queue, gpr_inf_past(GPR_CLOCK_MONOTONIC), NULL); + + if (event.type == GRPC_OP_COMPLETE) { + Nan::Callback *callback = grpc::node::GetTagCallback(event.tag); + if (event.success) { + Local argv[] = {Nan::Null(), + grpc::node::GetTagNodeValue(event.tag)}; + callback->Call(2, argv); + } else { + Local argv[] = {Nan::Error( + "The async function encountered an error")}; + callback->Call(1, argv); + } + grpc::node::CompleteTag(event.tag); + grpc::node::DestroyTag(event.tag); + pending_batches--; + if (pending_batches == 0) { + uv_prepare_stop(&prepare); + } + } + } while (event.type != GRPC_QUEUE_TIMEOUT); +} + +grpc_completion_queue *GetCompletionQueue() { +#ifdef GRPC_UV + return queue; +#else + return CompletionQueueAsyncWorker::GetQueue(); +#endif +} + +void CompletionQueueNext() { +#ifdef GRPC_UV + if (pending_batches == 0) { + GPR_ASSERT(!uv_is_active((uv_handle_t *)&prepare)); + uv_prepare_start(&prepare, drain_completion_queue); + } + pending_batches++; +#else + CompletionQueueAsyncWorker::Next(); +#endif +} + +void CompletionQueueInit(Local exports) { +#ifdef GRPC_UV + queue = grpc_completion_queue_create(NULL); + uv_prepare_init(uv_default_loop(), &prepare); + pending_batches = 0; +#else + CompletionQueueAsyncWorker::Init(exports); +#endif +} + +} // namespace node +} // namespace grpc diff --git a/src/node/ext/completion_queue.h b/src/node/ext/completion_queue.h new file mode 100644 index 0000000000..bf280f768b --- /dev/null +++ b/src/node/ext/completion_queue.h @@ -0,0 +1,46 @@ +/* + * + * Copyright 2016, 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 + +namespace grpc { +namespace node { + +grpc_completion_queue *GetCompletionQueue(); + +void CompletionQueueNext(); + +void CompletionQueueInit(v8::Local exports); + +} // namespace node +} // namespace grpc diff --git a/src/node/ext/completion_queue_async_worker.cc b/src/node/ext/completion_queue_async_worker.cc index 619ea41515..f5e03b277b 100644 --- a/src/node/ext/completion_queue_async_worker.cc +++ b/src/node/ext/completion_queue_async_worker.cc @@ -74,6 +74,7 @@ void CompletionQueueAsyncWorker::Execute() { grpc_completion_queue *CompletionQueueAsyncWorker::GetQueue() { return queue; } void CompletionQueueAsyncWorker::Next() { +#ifndef GRPC_UV Nan::HandleScope scope; if (current_threads < max_queue_threads) { current_threads += 1; @@ -85,6 +86,7 @@ void CompletionQueueAsyncWorker::Next() { GPR_ASSERT(current_threads <= max_queue_threads); GPR_ASSERT((current_threads == max_queue_threads) || (waiting_next_calls == 0)); +#endif } void CompletionQueueAsyncWorker::Init(Local exports) { diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index 745b5023d5..a246a8c678 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -50,6 +50,7 @@ #include "completion_queue_async_worker.h" #include "server_credentials.h" #include "timeval.h" +#include "completion_queue.h" using v8::FunctionTemplate; using v8::Local; @@ -261,8 +262,8 @@ void InitLogConstants(Local exports) { Nan::HandleScope scope; Local log_verbosity = Nan::New(); Nan::Set(exports, Nan::New("logVerbosity").ToLocalChecked(), log_verbosity); - Local DEBUG(Nan::New(GPR_LOG_SEVERITY_DEBUG)); - Nan::Set(log_verbosity, Nan::New("DEBUG").ToLocalChecked(), DEBUG); + Local DEBUG_LOG(Nan::New(GPR_LOG_SEVERITY_DEBUG)); + Nan::Set(log_verbosity, Nan::New("DEBUG").ToLocalChecked(), DEBUG_LOG); Local INFO(Nan::New(GPR_LOG_SEVERITY_INFO)); Nan::Set(log_verbosity, Nan::New("INFO").ToLocalChecked(), INFO); Local LOG_ERROR(Nan::New(GPR_LOG_SEVERITY_ERROR)); @@ -414,6 +415,12 @@ NAN_METHOD(SetLogVerbosity) { gpr_set_log_verbosity(severity); } +uv_signal_t signal_handle; + +void signal_callback(uv_signal_t *handle, int signum) { + uv_print_all_handles(uv_default_loop(), stderr); +} + void init(Local exports) { Nan::HandleScope scope; grpc_init(); @@ -428,14 +435,20 @@ void init(Local exports) { InitWriteFlags(exports); InitLogConstants(exports); + uv_signal_init(uv_default_loop(), &signal_handle); + uv_signal_start(&signal_handle, signal_callback, SIGUSR2); + uv_unref((uv_handle_t *)&signal_handle); + + grpc::node::Call::Init(exports); grpc::node::CallCredentials::Init(exports); grpc::node::Channel::Init(exports); grpc::node::ChannelCredentials::Init(exports); grpc::node::Server::Init(exports); - grpc::node::CompletionQueueAsyncWorker::Init(exports); grpc::node::ServerCredentials::Init(exports); + grpc::node::CompletionQueueInit(exports); + // Attach a few utility functions directly to the module Nan::Set(exports, Nan::New("metadataKeyIsLegal").ToLocalChecked(), Nan::GetFunction( diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index dd1b777ac8..29f31ff15e 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -40,6 +40,7 @@ #include #include "call.h" +#include "completion_queue.h" #include "completion_queue_async_worker.h" #include "grpc/grpc.h" #include "grpc/grpc_security.h" @@ -64,6 +65,7 @@ using v8::Array; using v8::Boolean; using v8::Date; using v8::Exception; +using v8::External; using v8::Function; using v8::FunctionTemplate; using v8::Local; @@ -75,6 +77,8 @@ using v8::Value; Nan::Callback *Server::constructor; Persistent Server::fun_tpl; +static Callback *shutdown_callback; + class NewCallOp : public Op { public: NewCallOp() { @@ -111,6 +115,9 @@ class NewCallOp : public Op { shared_ptr resources) { return true; } + bool IsFinalOp() { + return false; + } grpc_call *call; grpc_call_details details; @@ -120,17 +127,50 @@ class NewCallOp : public Op { std::string GetTypeString() const { return "new_call"; } }; +class ServerShutdownOp : public Op { + public: + ServerShutdownOp(grpc_server *server): server(server) { + } + + ~ServerShutdownOp() { + } + + Local GetNodeValue() const { + return Nan::New(reinterpret_cast(server)); + } + + bool ParseOp(Local value, grpc_op *out, + shared_ptr resources) { + return true; + } + bool IsFinalOp() { + return false; + } + + grpc_server *server; + + protected: + std::string GetTypeString() const { return "shutdown"; } +}; + +NAN_METHOD(ServerShutdownCallback) { + if (!info[0]->IsNull()) { + return Nan::ThrowError("forceShutdown failed somehow"); + } + MaybeLocal maybe_result = Nan::To(info[1]); + Local result = maybe_result.ToLocalChecked(); + Local server_val = Nan::Get( + result, Nan::New("shutdown").ToLocalChecked()).ToLocalChecked(); + Local server_extern = server_val.As(); + grpc_server *server = reinterpret_cast(server_extern->Value()); + grpc_server_destroy(server); +} + Server::Server(grpc_server *server) : wrapped_server(server) { - shutdown_queue = grpc_completion_queue_create(NULL); - grpc_server_register_non_listening_completion_queue(server, shutdown_queue, - NULL); } Server::~Server() { this->ShutdownServer(); - grpc_completion_queue_shutdown(this->shutdown_queue); - grpc_server_destroy(this->wrapped_server); - grpc_completion_queue_destroy(this->shutdown_queue); } void Server::Init(Local exports) { @@ -147,6 +187,11 @@ void Server::Init(Local exports) { Local ctr = Nan::GetFunction(tpl).ToLocalChecked(); Nan::Set(exports, Nan::New("Server").ToLocalChecked(), ctr); constructor = new Callback(ctr); + + Localcallback_tpl = + Nan::New(ServerShutdownCallback); + shutdown_callback = new Callback( + Nan::GetFunction(callback_tpl).ToLocalChecked()); } bool Server::HasInstance(Local val) { @@ -155,11 +200,19 @@ bool Server::HasInstance(Local val) { } void Server::ShutdownServer() { - grpc_server_shutdown_and_notify(this->wrapped_server, this->shutdown_queue, - NULL); - grpc_server_cancel_all_calls(this->wrapped_server); - grpc_completion_queue_pluck(this->shutdown_queue, NULL, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + if (this->wrapped_server != NULL) { + ServerShutdownOp *op = new ServerShutdownOp(this->wrapped_server); + unique_ptr ops(new OpVec()); + ops->push_back(unique_ptr(op)); + + grpc_server_shutdown_and_notify( + this->wrapped_server, GetCompletionQueue(), + new struct tag(new Callback(**shutdown_callback), ops.release(), + shared_ptr(nullptr), NULL)); + grpc_server_cancel_all_calls(this->wrapped_server); + CompletionQueueNext(); + this->wrapped_server = NULL; + } } NAN_METHOD(Server::New) { @@ -179,7 +232,7 @@ NAN_METHOD(Server::New) { } } grpc_server *wrapped_server; - grpc_completion_queue *queue = CompletionQueueAsyncWorker::GetQueue(); + grpc_completion_queue *queue = GetCompletionQueue(); grpc_channel_args *channel_args; if (!ParseChannelArgs(info[0], &channel_args)) { DeallocateChannelArgs(channel_args); @@ -205,14 +258,14 @@ NAN_METHOD(Server::RequestCall) { ops->push_back(unique_ptr(op)); grpc_call_error error = grpc_server_request_call( server->wrapped_server, &op->call, &op->details, &op->request_metadata, - CompletionQueueAsyncWorker::GetQueue(), - CompletionQueueAsyncWorker::GetQueue(), + GetCompletionQueue(), + GetCompletionQueue(), new struct tag(new Callback(info[0].As()), ops.release(), - shared_ptr(nullptr))); + shared_ptr(nullptr), NULL)); if (error != GRPC_CALL_OK) { return Nan::ThrowError(nanErrorWithCode("requestCall failed", error)); } - CompletionQueueAsyncWorker::Next(); + CompletionQueueNext(); } NAN_METHOD(Server::AddHttp2Port) { @@ -259,10 +312,10 @@ NAN_METHOD(Server::TryShutdown) { Server *server = ObjectWrap::Unwrap(info.This()); unique_ptr ops(new OpVec()); grpc_server_shutdown_and_notify( - server->wrapped_server, CompletionQueueAsyncWorker::GetQueue(), + server->wrapped_server, GetCompletionQueue(), new struct tag(new Nan::Callback(info[0].As()), ops.release(), - shared_ptr(nullptr))); - CompletionQueueAsyncWorker::Next(); + shared_ptr(nullptr), NULL)); + CompletionQueueNext(); } NAN_METHOD(Server::ForceShutdown) { diff --git a/src/node/ext/server.h b/src/node/ext/server.h index ab5fc210e8..9e6a7bd1e0 100644 --- a/src/node/ext/server.h +++ b/src/node/ext/server.h @@ -73,7 +73,6 @@ class Server : public Nan::ObjectWrap { static Nan::Persistent fun_tpl; grpc_server *wrapped_server; - grpc_completion_queue *shutdown_queue; }; } // namespace node diff --git a/src/node/ext/server_credentials.cc b/src/node/ext/server_credentials.cc index a817ade518..0ff58bb209 100644 --- a/src/node/ext/server_credentials.cc +++ b/src/node/ext/server_credentials.cc @@ -169,18 +169,18 @@ NAN_METHOD(ServerCredentials::CreateSsl) { for(uint32_t i = 0; i < key_cert_pair_count; i++) { Local pair_val = Nan::Get(pair_list, i).ToLocalChecked(); if (!pair_val->IsObject()) { - delete key_cert_pairs; + delete[] key_cert_pairs; return Nan::ThrowTypeError("Key/cert pairs must be objects"); } Local pair_obj = Nan::To(pair_val).ToLocalChecked(); Local maybe_key = Nan::Get(pair_obj, key_key).ToLocalChecked(); Local maybe_cert = Nan::Get(pair_obj, cert_key).ToLocalChecked(); if (!::node::Buffer::HasInstance(maybe_key)) { - delete key_cert_pairs; + delete[] key_cert_pairs; return Nan::ThrowTypeError("private_key must be a Buffer"); } if (!::node::Buffer::HasInstance(maybe_cert)) { - delete key_cert_pairs; + delete[] key_cert_pairs; return Nan::ThrowTypeError("cert_chain must be a Buffer"); } key_cert_pairs[i].private_key = ::node::Buffer::Data(maybe_key); @@ -189,7 +189,7 @@ NAN_METHOD(ServerCredentials::CreateSsl) { grpc_server_credentials *creds = grpc_ssl_server_credentials_create_ex( root_certs, key_cert_pairs, key_cert_pair_count, client_certificate_request, NULL); - delete key_cert_pairs; + delete[] key_cert_pairs; if (creds == NULL) { info.GetReturnValue().SetNull(); } else { diff --git a/src/node/index.js b/src/node/index.js index 9fb6faa5d7..a294aad8ee 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -219,3 +219,7 @@ exports.getClientChannel = client.getClientChannel; * @see module:src/client.waitForClientReady */ exports.waitForClientReady = client.waitForClientReady; + +exports.closeClient = function closeClient(client_obj) { + client.getClientChannel(client_obj).close(); +}; diff --git a/src/node/src/client.js b/src/node/src/client.js index f75f951eb8..9c1562e8b8 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -382,6 +382,7 @@ function makeUnaryRequestFunction(method, serialize, deserialize) { if (args.options) { message.grpcWriteFlags = args.options.flags; } + client_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata._getCoreRepresentation(); client_batch[grpc.opType.SEND_MESSAGE] = message; diff --git a/src/node/src/grpc_extension.js b/src/node/src/grpc_extension.js index 6a8fe2c03c..63a281ddbc 100644 --- a/src/node/src/grpc_extension.js +++ b/src/node/src/grpc_extension.js @@ -31,7 +31,7 @@ * */ -var binary = require('node-pre-gyp'); +var binary = require('node-pre-gyp/lib/pre-binding'); var path = require('path'); var binding_path = binary.find(path.resolve(path.join(__dirname, '../../../package.json'))); diff --git a/src/node/test/async_test.js b/src/node/test/async_test.js index c46e745116..7b467e5475 100644 --- a/src/node/test/async_test.js +++ b/src/node/test/async_test.js @@ -61,6 +61,7 @@ describe('Async functionality', function() { done(); }); after(function() { + grpc.closeClient(math_client); server.forceShutdown(); }); it('should not hang', function(done) { diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index ab7b461178..9fe0ef3c00 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -104,29 +104,38 @@ CORE_SOURCE_FILES = [ 'src/core/lib/iomgr/iocp_windows.c', 'src/core/lib/iomgr/iomgr.c', 'src/core/lib/iomgr/iomgr_posix.c', + 'src/core/lib/iomgr/iomgr_uv.c', 'src/core/lib/iomgr/iomgr_windows.c', 'src/core/lib/iomgr/load_file.c', 'src/core/lib/iomgr/network_status_tracker.c', 'src/core/lib/iomgr/polling_entity.c', + 'src/core/lib/iomgr/pollset_set_uv.c', 'src/core/lib/iomgr/pollset_set_windows.c', + 'src/core/lib/iomgr/pollset_uv.c', 'src/core/lib/iomgr/pollset_windows.c', 'src/core/lib/iomgr/resolve_address_posix.c', + 'src/core/lib/iomgr/resolve_address_uv.c', 'src/core/lib/iomgr/resolve_address_windows.c', 'src/core/lib/iomgr/sockaddr_utils.c', 'src/core/lib/iomgr/socket_utils_common_posix.c', 'src/core/lib/iomgr/socket_utils_linux.c', 'src/core/lib/iomgr/socket_utils_posix.c', + 'src/core/lib/iomgr/socket_utils_uv.c', 'src/core/lib/iomgr/socket_utils_windows.c', 'src/core/lib/iomgr/socket_windows.c', 'src/core/lib/iomgr/tcp_client_posix.c', + 'src/core/lib/iomgr/tcp_client_uv.c', 'src/core/lib/iomgr/tcp_client_windows.c', 'src/core/lib/iomgr/tcp_posix.c', 'src/core/lib/iomgr/tcp_server_posix.c', + 'src/core/lib/iomgr/tcp_server_uv.c', 'src/core/lib/iomgr/tcp_server_windows.c', + 'src/core/lib/iomgr/tcp_uv.c', 'src/core/lib/iomgr/tcp_windows.c', 'src/core/lib/iomgr/time_averaged_stats.c', - 'src/core/lib/iomgr/timer.c', + 'src/core/lib/iomgr/timer_generic.c', 'src/core/lib/iomgr/timer_heap.c', + 'src/core/lib/iomgr/timer_uv.c', 'src/core/lib/iomgr/udp_server.c', 'src/core/lib/iomgr/unix_sockets_posix.c', 'src/core/lib/iomgr/unix_sockets_posix_noop.c', @@ -135,6 +144,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/iomgr/wakeup_fd_pipe.c', 'src/core/lib/iomgr/wakeup_fd_posix.c', 'src/core/lib/iomgr/workqueue_posix.c', + 'src/core/lib/iomgr/workqueue_uv.c', 'src/core/lib/iomgr/workqueue_windows.c', 'src/core/lib/json/json.c', 'src/core/lib/json/json_reader.c', diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 40d430f792..e6592acebb 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -44,6 +44,9 @@ '.', 'include' ], + 'defines': [ + 'GRPC_UV' + ], 'conditions': [ ['OS == "win"', { "include_dirs": [ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 24c78091c7..fdda3c0a38 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -825,6 +825,7 @@ src/core/lib/iomgr/polling_entity.h \ src/core/lib/iomgr/pollset.h \ src/core/lib/iomgr/pollset_set.h \ src/core/lib/iomgr/pollset_set_windows.h \ +src/core/lib/iomgr/pollset_uv.h \ src/core/lib/iomgr/pollset_windows.h \ src/core/lib/iomgr/port.h \ src/core/lib/iomgr/resolve_address.h \ @@ -838,16 +839,20 @@ src/core/lib/iomgr/socket_windows.h \ src/core/lib/iomgr/tcp_client.h \ src/core/lib/iomgr/tcp_posix.h \ src/core/lib/iomgr/tcp_server.h \ +src/core/lib/iomgr/tcp_uv.h \ src/core/lib/iomgr/tcp_windows.h \ src/core/lib/iomgr/time_averaged_stats.h \ src/core/lib/iomgr/timer.h \ +src/core/lib/iomgr/timer_generic.h \ src/core/lib/iomgr/timer_heap.h \ +src/core/lib/iomgr/timer_uv.h \ src/core/lib/iomgr/udp_server.h \ src/core/lib/iomgr/unix_sockets_posix.h \ src/core/lib/iomgr/wakeup_fd_pipe.h \ src/core/lib/iomgr/wakeup_fd_posix.h \ src/core/lib/iomgr/workqueue.h \ src/core/lib/iomgr/workqueue_posix.h \ +src/core/lib/iomgr/workqueue_uv.h \ src/core/lib/iomgr/workqueue_windows.h \ src/core/lib/json/json.h \ src/core/lib/json/json_common.h \ @@ -980,29 +985,38 @@ src/core/lib/iomgr/executor.c \ src/core/lib/iomgr/iocp_windows.c \ src/core/lib/iomgr/iomgr.c \ src/core/lib/iomgr/iomgr_posix.c \ +src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ +src/core/lib/iomgr/pollset_set_uv.c \ src/core/lib/iomgr/pollset_set_windows.c \ +src/core/lib/iomgr/pollset_uv.c \ src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/resolve_address_posix.c \ +src/core/lib/iomgr/resolve_address_uv.c \ src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_posix.c \ +src/core/lib/iomgr/socket_utils_uv.c \ src/core/lib/iomgr/socket_utils_windows.c \ src/core/lib/iomgr/socket_windows.c \ src/core/lib/iomgr/tcp_client_posix.c \ +src/core/lib/iomgr/tcp_client_uv.c \ src/core/lib/iomgr/tcp_client_windows.c \ src/core/lib/iomgr/tcp_posix.c \ src/core/lib/iomgr/tcp_server_posix.c \ +src/core/lib/iomgr/tcp_server_uv.c \ src/core/lib/iomgr/tcp_server_windows.c \ +src/core/lib/iomgr/tcp_uv.c \ src/core/lib/iomgr/tcp_windows.c \ src/core/lib/iomgr/time_averaged_stats.c \ -src/core/lib/iomgr/timer.c \ +src/core/lib/iomgr/timer_generic.c \ src/core/lib/iomgr/timer_heap.c \ +src/core/lib/iomgr/timer_uv.c \ src/core/lib/iomgr/udp_server.c \ src/core/lib/iomgr/unix_sockets_posix.c \ src/core/lib/iomgr/unix_sockets_posix_noop.c \ @@ -1011,6 +1025,7 @@ src/core/lib/iomgr/wakeup_fd_nospecial.c \ src/core/lib/iomgr/wakeup_fd_pipe.c \ src/core/lib/iomgr/wakeup_fd_posix.c \ src/core/lib/iomgr/workqueue_posix.c \ +src/core/lib/iomgr/workqueue_uv.c \ src/core/lib/iomgr/workqueue_windows.c \ src/core/lib/json/json.c \ src/core/lib/json/json_reader.c \ diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index 4dfd01fc66..6fa3abaece 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -343,11 +343,20 @@ class NodeLanguage: # 'node_protobuf_async_streaming_ping_pong', rpc_type='STREAMING', # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER') + + # 50 | 90 | 95 | 99 | 99.9 + # 323834.797877769 | 432510.52549709007 | 458703.85481928807 | 507691.6539182514 | 3826148.8700816636 + # 272716.21113941644 | 307298.29139655043 | 329730.74530904385 | 413965.4319992619 | 2518204.1519497186 yield _ping_pong_scenario( 'node_protobuf_unary_ping_pong', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', categories=[SMOKETEST]) + yield _ping_pong_scenario( + 'cpp_to_node_unary_ping_pong', rpc_type='UNARY', + client_type='ASYNC_CLIENT', server_type='async_server', + client_language='c++') + yield _ping_pong_scenario( 'node_protobuf_async_unary_qps_unconstrained', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', @@ -548,7 +557,7 @@ class JavaLanguage: async_server_threads=1, secure=secure, warmup_seconds=JAVA_WARMUP_SECONDS) - # TODO(jtattermusch): add scenarios java vs C++ + # TODO(jtattermusch): add scenarios java vs C++ def __str__(self): return 'java' @@ -572,7 +581,7 @@ class GoLanguage: smoketest_categories = [SMOKETEST] if secure else [] # ASYNC_GENERIC_SERVER for Go actually uses a sync streaming server, - # but that's mostly because of lack of better name of the enum value. + # but that's mostly because of lack of better name of the enum value. yield _ping_pong_scenario( 'go_generic_sync_streaming_ping_pong_%s' % secstr, rpc_type='STREAMING', client_type='SYNC_CLIENT', server_type='ASYNC_GENERIC_SERVER', @@ -619,7 +628,7 @@ class GoLanguage: secure=secure, categories=[SCALABLE]) - # TODO(jtattermusch): add scenarios go vs C++ + # TODO(jtattermusch): add scenarios go vs C++ def __str__(self): return 'go' diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index b3c217196b..01cd177c3d 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -5851,6 +5851,7 @@ "src/core/lib/iomgr/pollset.h", "src/core/lib/iomgr/pollset_set.h", "src/core/lib/iomgr/pollset_set_windows.h", + "src/core/lib/iomgr/pollset_uv.h", "src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", @@ -5864,16 +5865,20 @@ "src/core/lib/iomgr/tcp_client.h", "src/core/lib/iomgr/tcp_posix.h", "src/core/lib/iomgr/tcp_server.h", + "src/core/lib/iomgr/tcp_uv.h", "src/core/lib/iomgr/tcp_windows.h", "src/core/lib/iomgr/time_averaged_stats.h", "src/core/lib/iomgr/timer.h", + "src/core/lib/iomgr/timer_generic.h", "src/core/lib/iomgr/timer_heap.h", + "src/core/lib/iomgr/timer_uv.h", "src/core/lib/iomgr/udp_server.h", "src/core/lib/iomgr/unix_sockets_posix.h", "src/core/lib/iomgr/wakeup_fd_pipe.h", "src/core/lib/iomgr/wakeup_fd_posix.h", "src/core/lib/iomgr/workqueue.h", "src/core/lib/iomgr/workqueue_posix.h", + "src/core/lib/iomgr/workqueue_uv.h", "src/core/lib/iomgr/workqueue_windows.h", "src/core/lib/json/json.h", "src/core/lib/json/json_common.h", @@ -5965,6 +5970,7 @@ "src/core/lib/iomgr/iomgr_internal.h", "src/core/lib/iomgr/iomgr_posix.c", "src/core/lib/iomgr/iomgr_posix.h", + "src/core/lib/iomgr/iomgr_uv.c", "src/core/lib/iomgr/iomgr_windows.c", "src/core/lib/iomgr/load_file.c", "src/core/lib/iomgr/load_file.h", @@ -5974,13 +5980,17 @@ "src/core/lib/iomgr/polling_entity.h", "src/core/lib/iomgr/pollset.h", "src/core/lib/iomgr/pollset_set.h", + "src/core/lib/iomgr/pollset_set_uv.c", "src/core/lib/iomgr/pollset_set_windows.c", "src/core/lib/iomgr/pollset_set_windows.h", + "src/core/lib/iomgr/pollset_uv.c", + "src/core/lib/iomgr/pollset_uv.h", "src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/port.h", "src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/resolve_address_posix.c", + "src/core/lib/iomgr/resolve_address_uv.c", "src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr_posix.h", @@ -5992,25 +6002,33 @@ "src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_posix.c", "src/core/lib/iomgr/socket_utils_posix.h", + "src/core/lib/iomgr/socket_utils_uv.c", "src/core/lib/iomgr/socket_utils_windows.c", "src/core/lib/iomgr/socket_windows.c", "src/core/lib/iomgr/socket_windows.h", "src/core/lib/iomgr/tcp_client.h", "src/core/lib/iomgr/tcp_client_posix.c", + "src/core/lib/iomgr/tcp_client_uv.c", "src/core/lib/iomgr/tcp_client_windows.c", "src/core/lib/iomgr/tcp_posix.c", "src/core/lib/iomgr/tcp_posix.h", "src/core/lib/iomgr/tcp_server.h", "src/core/lib/iomgr/tcp_server_posix.c", + "src/core/lib/iomgr/tcp_server_uv.c", "src/core/lib/iomgr/tcp_server_windows.c", + "src/core/lib/iomgr/tcp_uv.c", + "src/core/lib/iomgr/tcp_uv.h", "src/core/lib/iomgr/tcp_windows.c", "src/core/lib/iomgr/tcp_windows.h", "src/core/lib/iomgr/time_averaged_stats.c", "src/core/lib/iomgr/time_averaged_stats.h", - "src/core/lib/iomgr/timer.c", "src/core/lib/iomgr/timer.h", + "src/core/lib/iomgr/timer_generic.c", + "src/core/lib/iomgr/timer_generic.h", "src/core/lib/iomgr/timer_heap.c", "src/core/lib/iomgr/timer_heap.h", + "src/core/lib/iomgr/timer_uv.c", + "src/core/lib/iomgr/timer_uv.h", "src/core/lib/iomgr/udp_server.c", "src/core/lib/iomgr/udp_server.h", "src/core/lib/iomgr/unix_sockets_posix.c", @@ -6025,6 +6043,8 @@ "src/core/lib/iomgr/workqueue.h", "src/core/lib/iomgr/workqueue_posix.c", "src/core/lib/iomgr/workqueue_posix.h", + "src/core/lib/iomgr/workqueue_uv.c", + "src/core/lib/iomgr/workqueue_uv.h", "src/core/lib/iomgr/workqueue_windows.c", "src/core/lib/iomgr/workqueue_windows.h", "src/core/lib/json/json.c", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index d09c07d0cb..32f03824cc 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -334,6 +334,7 @@ + @@ -347,16 +348,20 @@ + + + + @@ -520,6 +525,8 @@ + + @@ -528,12 +535,18 @@ + + + + + + @@ -544,28 +557,38 @@ + + + + + + + + - + + + @@ -582,6 +605,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index d5ac3d4422..c04b13c313 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -88,6 +88,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -100,15 +103,24 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -124,6 +136,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -133,6 +148,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -142,21 +160,30 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr src\core\lib\iomgr - + src\core\lib\iomgr src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -181,6 +208,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -770,6 +800,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -809,6 +842,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -818,9 +854,15 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -839,6 +881,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index 84e2a60d58..6a6a61e108 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -224,6 +224,7 @@ + @@ -237,16 +238,20 @@ + + + + @@ -363,6 +368,8 @@ + + @@ -371,12 +378,18 @@ + + + + + + @@ -387,28 +400,38 @@ + + + + + + + + - + + + @@ -425,6 +448,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index 1a2ecf91df..cc114e9455 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -136,6 +136,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -148,15 +151,24 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -172,6 +184,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -181,6 +196,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -190,21 +208,30 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr src\core\lib\iomgr - + src\core\lib\iomgr src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -229,6 +256,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -551,6 +581,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -590,6 +623,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -599,9 +635,15 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -620,6 +662,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index d053dd9a30..1ba32f28c1 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -323,6 +323,7 @@ + @@ -336,16 +337,20 @@ + + + + @@ -487,6 +492,8 @@ + + @@ -495,12 +502,18 @@ + + + + + + @@ -511,28 +524,38 @@ + + + + + + + + - + + + @@ -549,6 +572,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 7edd0db4b6..8cb8d4ca98 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -91,6 +91,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -103,15 +106,24 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -127,6 +139,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -136,6 +151,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -145,21 +163,30 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr src\core\lib\iomgr - + src\core\lib\iomgr src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -184,6 +211,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -680,6 +710,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -719,6 +752,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -728,9 +764,15 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -749,6 +791,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr -- cgit v1.2.3 From c36f6ea7457e05a55f282c06f565c289750c0768 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 3 Oct 2016 09:24:09 -0700 Subject: Compile and link core tests with libuv --- BUILD | 6 + CMakeLists.txt | 5 + Makefile | 24 +++- binding.gyp | 1 + build.yaml | 17 +++ config.m4 | 1 + gRPC-Core.podspec | 1 + grpc.gemspec | 1 + package.xml | 1 + src/boringssl/gen_build_yaml.py | 2 +- src/core/lib/iomgr/endpoint_pair_uv.c | 50 +++++++ src/core/lib/iomgr/sockaddr.h | 3 +- src/core/lib/iomgr/tcp_client.h | 1 - src/core/lib/iomgr/tcp_client_uv.c | 25 +++- src/core/lib/iomgr/tcp_uv.c | 8 +- src/python/grpcio/grpc_core_dependencies.py | 1 + templates/Makefile.template | 9 +- templates/tools/run_tests/tests.json.template | 1 + .../set_initial_connect_string_test.c | 3 +- test/core/end2end/bad_server_response_test.c | 3 +- test/core/end2end/cq_verifier.c | 46 ++---- test/core/end2end/cq_verifier_internal.h | 47 +++++++ test/core/end2end/cq_verifier_native.c | 73 ++++++++++ test/core/end2end/cq_verifier_uv.c | 108 ++++++++++++++ test/core/end2end/dualstack_socket_test.c | 13 ++ test/core/end2end/fixtures/h2_fd.c | 13 ++ test/core/end2end/fixtures/h2_full+pipe.c | 13 ++ test/core/end2end/fixtures/http_proxy.c | 2 + test/core/end2end/fuzzers/api_fuzzer.c | 6 +- test/core/end2end/gen_build_yaml.py | 8 +- test/core/iomgr/fd_posix_test.c | 13 ++ test/core/iomgr/socket_utils_test.c | 14 +- test/core/iomgr/tcp_posix_test.c | 13 ++ test/core/iomgr/tcp_server_posix_test.c | 13 ++ test/core/iomgr/timer_heap_test.c | 13 ++ test/core/util/port_server_client.c | 2 +- test/core/util/port_uv.c | 58 ++++++++ tools/doxygen/Doxyfile.c++.internal | 1 + tools/doxygen/Doxyfile.core.internal | 1 + tools/run_tests/run_tests.py | 21 ++- tools/run_tests/sources_and_headers.json | 6 + tools/run_tests/tests.json | 156 +++++++++++++++++++++ vsprojects/vcxproj/grpc++/grpc++.vcxproj | 2 + vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters | 3 + .../grpc++_unsecure/grpc++_unsecure.vcxproj | 2 + .../grpc++_unsecure.vcxproj.filters | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj | 2 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 3 + .../vcxproj/grpc_test_util/grpc_test_util.vcxproj | 9 ++ .../grpc_test_util/grpc_test_util.vcxproj.filters | 15 ++ .../grpc_test_util_unsecure.vcxproj | 7 + .../grpc_test_util_unsecure.vcxproj.filters | 12 ++ .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 2 + .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 3 + 54 files changed, 800 insertions(+), 66 deletions(-) create mode 100644 src/core/lib/iomgr/endpoint_pair_uv.c create mode 100644 test/core/end2end/cq_verifier_internal.h create mode 100644 test/core/end2end/cq_verifier_native.c create mode 100644 test/core/end2end/cq_verifier_uv.c create mode 100644 test/core/util/port_uv.c (limited to 'tools/doxygen/Doxyfile.core.internal') diff --git a/BUILD b/BUILD index 0a0af3491c..e4a79b29fc 100644 --- a/BUILD +++ b/BUILD @@ -348,6 +348,7 @@ cc_library( "src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint_pair_posix.c", + "src/core/lib/iomgr/endpoint_pair_uv.c", "src/core/lib/iomgr/endpoint_pair_windows.c", "src/core/lib/iomgr/error.c", "src/core/lib/iomgr/ev_epoll_linux.c", @@ -749,6 +750,7 @@ cc_library( "src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint_pair_posix.c", + "src/core/lib/iomgr/endpoint_pair_uv.c", "src/core/lib/iomgr/endpoint_pair_windows.c", "src/core/lib/iomgr/error.c", "src/core/lib/iomgr/ev_epoll_linux.c", @@ -1112,6 +1114,7 @@ cc_library( "src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint_pair_posix.c", + "src/core/lib/iomgr/endpoint_pair_uv.c", "src/core/lib/iomgr/endpoint_pair_windows.c", "src/core/lib/iomgr/error.c", "src/core/lib/iomgr/ev_epoll_linux.c", @@ -1459,6 +1462,7 @@ cc_library( "src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint_pair_posix.c", + "src/core/lib/iomgr/endpoint_pair_uv.c", "src/core/lib/iomgr/endpoint_pair_windows.c", "src/core/lib/iomgr/error.c", "src/core/lib/iomgr/ev_epoll_linux.c", @@ -1880,6 +1884,7 @@ cc_library( "src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint_pair_posix.c", + "src/core/lib/iomgr/endpoint_pair_uv.c", "src/core/lib/iomgr/endpoint_pair_windows.c", "src/core/lib/iomgr/error.c", "src/core/lib/iomgr/ev_epoll_linux.c", @@ -2279,6 +2284,7 @@ objc_library( "src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint_pair_posix.c", + "src/core/lib/iomgr/endpoint_pair_uv.c", "src/core/lib/iomgr/endpoint_pair_windows.c", "src/core/lib/iomgr/error.c", "src/core/lib/iomgr/ev_epoll_linux.c", diff --git a/CMakeLists.txt b/CMakeLists.txt index 916c83f6fb..7dec554f68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -309,6 +309,7 @@ add_library(grpc src/core/lib/iomgr/combiner.c src/core/lib/iomgr/endpoint.c src/core/lib/iomgr/endpoint_pair_posix.c + src/core/lib/iomgr/endpoint_pair_uv.c src/core/lib/iomgr/endpoint_pair_windows.c src/core/lib/iomgr/error.c src/core/lib/iomgr/ev_epoll_linux.c @@ -577,6 +578,7 @@ add_library(grpc_cronet src/core/lib/iomgr/combiner.c src/core/lib/iomgr/endpoint.c src/core/lib/iomgr/endpoint_pair_posix.c + src/core/lib/iomgr/endpoint_pair_uv.c src/core/lib/iomgr/endpoint_pair_windows.c src/core/lib/iomgr/error.c src/core/lib/iomgr/ev_epoll_linux.c @@ -817,6 +819,7 @@ add_library(grpc_unsecure src/core/lib/iomgr/combiner.c src/core/lib/iomgr/endpoint.c src/core/lib/iomgr/endpoint_pair_posix.c + src/core/lib/iomgr/endpoint_pair_uv.c src/core/lib/iomgr/endpoint_pair_windows.c src/core/lib/iomgr/error.c src/core/lib/iomgr/ev_epoll_linux.c @@ -1085,6 +1088,7 @@ add_library(grpc++ src/core/lib/iomgr/combiner.c src/core/lib/iomgr/endpoint.c src/core/lib/iomgr/endpoint_pair_posix.c + src/core/lib/iomgr/endpoint_pair_uv.c src/core/lib/iomgr/endpoint_pair_windows.c src/core/lib/iomgr/error.c src/core/lib/iomgr/ev_epoll_linux.c @@ -1449,6 +1453,7 @@ add_library(grpc++_unsecure src/core/lib/iomgr/combiner.c src/core/lib/iomgr/endpoint.c src/core/lib/iomgr/endpoint_pair_posix.c + src/core/lib/iomgr/endpoint_pair_uv.c src/core/lib/iomgr/endpoint_pair_windows.c src/core/lib/iomgr/error.c src/core/lib/iomgr/ev_epoll_linux.c diff --git a/Makefile b/Makefile index 6929046ee5..66a7450376 100644 --- a/Makefile +++ b/Makefile @@ -345,10 +345,6 @@ HOST_CXX ?= $(CXX) HOST_LD ?= $(LD) HOST_LDXX ?= $(LDXX) -ifdef EXTRA_DEFINES -DEFINES += $(EXTRA_DEFINES) -endif - CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) $(W_EXTRA_SEMI) ifeq ($(HAS_CXX11),true) CXXFLAGS += -std=c++11 @@ -447,6 +443,14 @@ LDFLAGS += $(ARCH_FLAGS) LDLIBS += $(addprefix -l, $(LIBS)) LDLIBSXX += $(addprefix -l, $(LIBSXX)) + +CFLAGS += $(EXTRA_CFLAGS) +CXXFLAGS += $(EXTRA_CXXFLAGS) +CPPFLAGS += $(EXTRA_CPPFLAGS) +LDFLAGS += $(EXTRA_LDFLAGS) +DEFINES += $(EXTRA_DEFINES) +LDLIBS += $(EXTRA_LDLIBS) + HOST_CPPFLAGS = $(CPPFLAGS) HOST_CFLAGS = $(CFLAGS) HOST_CXXFLAGS = $(CXXFLAGS) @@ -2546,6 +2550,7 @@ LIBGRPC_SRC = \ src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ + src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ @@ -2832,6 +2837,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ + src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ @@ -3076,6 +3082,8 @@ LIBGRPC_TEST_UTIL_SRC = \ test/core/end2end/data/test_root_cert.c \ test/core/security/oauth2_utils.c \ test/core/end2end/cq_verifier.c \ + test/core/end2end/cq_verifier_native.c \ + test/core/end2end/cq_verifier_uv.c \ test/core/end2end/fixtures/http_proxy.c \ test/core/end2end/fixtures/proxy.c \ test/core/iomgr/endpoint_tests.c \ @@ -3086,6 +3094,7 @@ LIBGRPC_TEST_UTIL_SRC = \ test/core/util/passthru_endpoint.c \ test/core/util/port_posix.c \ test/core/util/port_server_client.c \ + test/core/util/port_uv.c \ test/core/util/port_windows.c \ test/core/util/slice_splitter.c \ src/core/lib/channel/channel_args.c \ @@ -3107,6 +3116,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ + src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ @@ -3253,6 +3263,8 @@ endif LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ test/core/end2end/cq_verifier.c \ + test/core/end2end/cq_verifier_native.c \ + test/core/end2end/cq_verifier_uv.c \ test/core/end2end/fixtures/http_proxy.c \ test/core/end2end/fixtures/proxy.c \ test/core/iomgr/endpoint_tests.c \ @@ -3263,6 +3275,7 @@ LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ test/core/util/passthru_endpoint.c \ test/core/util/port_posix.c \ test/core/util/port_server_client.c \ + test/core/util/port_uv.c \ test/core/util/port_windows.c \ test/core/util/slice_splitter.c \ @@ -3310,6 +3323,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ + src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ @@ -3661,6 +3675,7 @@ LIBGRPC++_SRC = \ src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ + src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ @@ -4300,6 +4315,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ + src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ diff --git a/binding.gyp b/binding.gyp index 3e63f73095..82ab51b71d 100644 --- a/binding.gyp +++ b/binding.gyp @@ -587,6 +587,7 @@ 'src/core/lib/iomgr/combiner.c', 'src/core/lib/iomgr/endpoint.c', 'src/core/lib/iomgr/endpoint_pair_posix.c', + 'src/core/lib/iomgr/endpoint_pair_uv.c', 'src/core/lib/iomgr/endpoint_pair_windows.c', 'src/core/lib/iomgr/error.c', 'src/core/lib/iomgr/ev_epoll_linux.c', diff --git a/build.yaml b/build.yaml index 86ede36fff..042b48fc9b 100644 --- a/build.yaml +++ b/build.yaml @@ -275,6 +275,7 @@ filegroups: - src/core/lib/iomgr/combiner.c - src/core/lib/iomgr/endpoint.c - src/core/lib/iomgr/endpoint_pair_posix.c + - src/core/lib/iomgr/endpoint_pair_uv.c - src/core/lib/iomgr/endpoint_pair_windows.c - src/core/lib/iomgr/error.c - src/core/lib/iomgr/ev_epoll_linux.c @@ -522,6 +523,7 @@ filegroups: build: test headers: - test/core/end2end/cq_verifier.h + - test/core/end2end/cq_verifier_internal.h - test/core/end2end/fixtures/http_proxy.h - test/core/end2end/fixtures/proxy.h - test/core/iomgr/endpoint_tests.h @@ -535,6 +537,8 @@ filegroups: - test/core/util/slice_splitter.h src: - test/core/end2end/cq_verifier.c + - test/core/end2end/cq_verifier_native.c + - test/core/end2end/cq_verifier_uv.c - test/core/end2end/fixtures/http_proxy.c - test/core/end2end/fixtures/proxy.c - test/core/iomgr/endpoint_tests.c @@ -545,6 +549,7 @@ filegroups: - test/core/util/passthru_endpoint.c - test/core/util/port_posix.c - test/core/util/port_server_client.c + - test/core/util/port_uv.c - test/core/util/port_windows.c - test/core/util/slice_splitter.c deps: @@ -1511,6 +1516,8 @@ targets: - grpc - gpr_test_util - gpr + exclude_iomgrs: + - uv platforms: - mac - linux @@ -2451,6 +2458,8 @@ targets: - grpc - gpr_test_util - gpr + exclude_iomgrs: + - uv platforms: - mac - linux @@ -2466,6 +2475,8 @@ targets: - grpc - gpr_test_util - gpr + exclude_iomgrs: + - uv platforms: - mac - linux @@ -2480,6 +2491,8 @@ targets: - grpc - gpr_test_util - gpr + exclude_iomgrs: + - uv platforms: - mac - linux @@ -2514,6 +2527,8 @@ targets: - grpc - gpr_test_util - gpr + exclude_iomgrs: + - uv - name: timer_list_test build: test language: c @@ -2524,6 +2539,8 @@ targets: - grpc - gpr_test_util - gpr + exclude_iomgrs: + - uv - name: transport_connectivity_state_test build: test language: c diff --git a/config.m4 b/config.m4 index 915c178289..275f176cbc 100644 --- a/config.m4 +++ b/config.m4 @@ -103,6 +103,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ + src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 479045d930..7ce0a0de23 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -439,6 +439,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/combiner.c', 'src/core/lib/iomgr/endpoint.c', 'src/core/lib/iomgr/endpoint_pair_posix.c', + 'src/core/lib/iomgr/endpoint_pair_uv.c', 'src/core/lib/iomgr/endpoint_pair_windows.c', 'src/core/lib/iomgr/error.c', 'src/core/lib/iomgr/ev_epoll_linux.c', diff --git a/grpc.gemspec b/grpc.gemspec index ae4c3926e7..a290751322 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -359,6 +359,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/combiner.c ) s.files += %w( src/core/lib/iomgr/endpoint.c ) s.files += %w( src/core/lib/iomgr/endpoint_pair_posix.c ) + s.files += %w( src/core/lib/iomgr/endpoint_pair_uv.c ) s.files += %w( src/core/lib/iomgr/endpoint_pair_windows.c ) s.files += %w( src/core/lib/iomgr/error.c ) s.files += %w( src/core/lib/iomgr/ev_epoll_linux.c ) diff --git a/package.xml b/package.xml index 55b5933f62..4e0dad9b3b 100644 --- a/package.xml +++ b/package.xml @@ -366,6 +366,7 @@ + diff --git a/src/boringssl/gen_build_yaml.py b/src/boringssl/gen_build_yaml.py index 20f6413adf..c53beb0da5 100755 --- a/src/boringssl/gen_build_yaml.py +++ b/src/boringssl/gen_build_yaml.py @@ -36,7 +36,7 @@ import yaml sys.dont_write_bytecode = True boring_ssl_root = os.path.abspath(os.path.join( - os.path.dirname(sys.argv[0]), + os.path.dirname(sys.argv[0]), '../../third_party/boringssl')) sys.path.append(os.path.join(boring_ssl_root, 'util')) diff --git a/src/core/lib/iomgr/endpoint_pair_uv.c b/src/core/lib/iomgr/endpoint_pair_uv.c new file mode 100644 index 0000000000..eeca8070b5 --- /dev/null +++ b/src/core/lib/iomgr/endpoint_pair_uv.c @@ -0,0 +1,50 @@ +/* + * + * Copyright 2016, 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 "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + +#include + +#include "src/core/lib/iomgr/endpoint_pair.h" + +grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, + size_t read_slice_size) { + grpc_endpoint_pair endpoint_pair; + // TODO(mlumish): implement this properly under libuv + abort(); + return endpoint_pair; +} + +#endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/sockaddr.h b/src/core/lib/iomgr/sockaddr.h index 75dc532d6c..52b504390d 100644 --- a/src/core/lib/iomgr/sockaddr.h +++ b/src/core/lib/iomgr/sockaddr.h @@ -32,7 +32,8 @@ */ /* This header transitively includes other headers that care about include - * order, so it should be included first */ + * order, so it should be included first. As a consequence, it should not be + * included in any other header. */ #ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_H #define GRPC_CORE_LIB_IOMGR_SOCKADDR_H diff --git a/src/core/lib/iomgr/tcp_client.h b/src/core/lib/iomgr/tcp_client.h index 83e69003f5..fe1e7f4d3e 100644 --- a/src/core/lib/iomgr/tcp_client.h +++ b/src/core/lib/iomgr/tcp_client.h @@ -38,7 +38,6 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolve_address.h" -#include "src/core/lib/iomgr/sockaddr.h" /* Asynchronously connect to an address (specified as (addr, len)), and call cb with arg and the completed connection when done (or call cb with arg and diff --git a/src/core/lib/iomgr/tcp_client_uv.c b/src/core/lib/iomgr/tcp_client_uv.c index 3a2cca5392..50e3615aad 100644 --- a/src/core/lib/iomgr/tcp_client_uv.c +++ b/src/core/lib/iomgr/tcp_client_uv.c @@ -116,11 +116,11 @@ static void uv_tc_on_connect(uv_connect_t *req, int status) { grpc_exec_ctx_finish(&exec_ctx); } -void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, - grpc_endpoint **ep, - grpc_pollset_set *interested_parties, - const grpc_resolved_address *resolved_addr, - gpr_timespec deadline) { +static void tcp_client_connect_impl(grpc_exec_ctx *exec_ctx, + grpc_closure *closure, grpc_endpoint **ep, + grpc_pollset_set *interested_parties, + const grpc_resolved_address *resolved_addr, + gpr_timespec deadline) { grpc_uv_tcp_connect *connect; (void)interested_parties; connect = gpr_malloc(sizeof(grpc_uv_tcp_connect)); @@ -141,4 +141,19 @@ void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, uv_tc_on_alarm, connect, gpr_now(GPR_CLOCK_MONOTONIC)); } +// overridden by api_fuzzer.c +void (*grpc_tcp_client_connect_impl)( + grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, + grpc_pollset_set *interested_parties, const grpc_resolved_address *addr, + gpr_timespec deadline) = tcp_client_connect_impl; + +void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, + grpc_endpoint **ep, + grpc_pollset_set *interested_parties, + const grpc_resolved_address *addr, + gpr_timespec deadline) { + grpc_tcp_client_connect_impl(exec_ctx, closure, ep, interested_parties, addr, + deadline); +} + #endif /* GRPC_UV */ diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index 270708bd29..88c4195c2b 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -135,7 +135,7 @@ static void read_callback(uv_stream_t *stream, ssize_t nread, error = GRPC_ERROR_CREATE("EOF"); } else if (nread > 0) { // Successful read - sub = gpr_slice_sub_no_ref(tcp->read_slice, 0, nread); + sub = gpr_slice_sub_no_ref(tcp->read_slice, 0, (size_t)nread); gpr_slice_buffer_add(tcp->read_slices, sub); error = GRPC_ERROR_NONE; if (grpc_tcp_trace) { @@ -217,10 +217,10 @@ static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, uv_write_t *write_req; if (grpc_tcp_trace) { - size_t i; + size_t j; - for (i = 0; i < write_slices->count; i++) { - char *data = gpr_dump_slice(write_slices->slices[i], + for (j = 0; j < write_slices->count; j++) { + char *data = gpr_dump_slice(write_slices->slices[j], GPR_DUMP_HEX | GPR_DUMP_ASCII); gpr_log(GPR_DEBUG, "WRITE %p (peer=%s): %s", tcp, tcp->peer_string, data); gpr_free(data); diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 997efe6b84..dd142c5a2e 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -97,6 +97,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/iomgr/combiner.c', 'src/core/lib/iomgr/endpoint.c', 'src/core/lib/iomgr/endpoint_pair_posix.c', + 'src/core/lib/iomgr/endpoint_pair_uv.c', 'src/core/lib/iomgr/endpoint_pair_windows.c', 'src/core/lib/iomgr/error.c', 'src/core/lib/iomgr/ev_epoll_linux.c', diff --git a/templates/Makefile.template b/templates/Makefile.template index e6a28d16bc..3b76ded95d 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -219,10 +219,6 @@ HOST_LD ?= $(LD) HOST_LDXX ?= $(LDXX) - ifdef EXTRA_DEFINES - DEFINES += $(EXTRA_DEFINES) - endif - CFLAGS += -std=c99 -Wsign-conversion -Wconversion ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)} ifeq ($(HAS_CXX11),true) CXXFLAGS += -std=c++11 @@ -324,6 +320,11 @@ LDLIBS += $(addprefix -l, $(LIBS)) LDLIBSXX += $(addprefix -l, $(LIBSXX)) + + % for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'DEFINES', 'LDLIBS']: + ${arg} += $(EXTRA_${arg}) + % endfor + HOST_CPPFLAGS = $(CPPFLAGS) HOST_CFLAGS = $(CFLAGS) HOST_CXXFLAGS = $(CXXFLAGS) diff --git a/templates/tools/run_tests/tests.json.template b/templates/tools/run_tests/tests.json.template index 5690874415..1e21465dd2 100644 --- a/templates/tools/run_tests/tests.json.template +++ b/templates/tools/run_tests/tests.json.template @@ -10,6 +10,7 @@ "ci_platforms": tgt.ci_platforms, "gtest": tgt.gtest, "exclude_configs": tgt.get("exclude_configs", []), + "exclude_iomgrs": tgt.get("exclude_iomgrs", []), "args": [], "flaky": tgt.flaky, "cpu_cost": tgt.get("cpu_cost", 1.0)} diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c index dcff859e4b..d79579aa71 100644 --- a/test/core/client_config/set_initial_connect_string_test.c +++ b/test/core/client_config/set_initial_connect_string_test.c @@ -30,6 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#include "src/core/lib/iomgr/sockaddr.h" + #include #include @@ -40,7 +42,6 @@ #include #include "src/core/ext/client_config/initial_connect_string.h" -#include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/security/credentials/fake/fake_credentials.h" #include "src/core/lib/support/string.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index 5ed0eb64d2..2fe3963b40 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -30,6 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#include "src/core/lib/iomgr/sockaddr.h" + #include #include @@ -40,7 +42,6 @@ #include // #include "src/core/ext/transport/chttp2/transport/internal.h" -#include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/support/string.h" #include "test/core/end2end/cq_verifier.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 1f42d3457e..9e6c0a4f4c 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -32,6 +32,7 @@ */ #include "test/core/end2end/cq_verifier.h" +#include "test/core/end2end/cq_verifier_internal.h" #include #include @@ -59,35 +60,15 @@ typedef struct metadata { /* details what we expect to find on a single event - and forms a linked list to detail other expectations */ -typedef struct expectation { +struct expectation { struct expectation *next; const char *file; int line; grpc_completion_type type; void *tag; int success; -} expectation; - -/* the verifier itself */ -struct cq_verifier { - /* bound completion queue */ - grpc_completion_queue *cq; - /* start of expectation list */ - expectation *first_expectation; }; -cq_verifier *cq_verifier_create(grpc_completion_queue *cq) { - cq_verifier *v = gpr_malloc(sizeof(cq_verifier)); - v->cq = cq; - v->first_expectation = NULL; - return v; -} - -void cq_verifier_destroy(cq_verifier *v) { - cq_verify(v); - gpr_free(v); -} - static int has_metadata(const grpc_metadata *md, size_t count, const char *key, const char *value) { size_t i; @@ -197,7 +178,7 @@ static void expectation_to_strvec(gpr_strvec *buf, expectation *e) { static void expectations_to_strvec(gpr_strvec *buf, cq_verifier *v) { expectation *e; - for (e = v->first_expectation; e != NULL; e = e->next) { + for (e = cq_verifier_get_first_expectation(v); e != NULL; e = e->next) { expectation_to_strvec(buf, e); gpr_strvec_add(buf, gpr_strdup("\n")); } @@ -217,19 +198,19 @@ static void fail_no_event_received(cq_verifier *v) { } void cq_verify(cq_verifier *v) { - const gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10); - while (v->first_expectation != NULL) { - grpc_event ev = grpc_completion_queue_next(v->cq, deadline, NULL); + int timeout_seconds = 10; + while (cq_verifier_get_first_expectation(v) != NULL) { + grpc_event ev = cq_verifier_next_event(v, timeout_seconds); if (ev.type == GRPC_QUEUE_TIMEOUT) { fail_no_event_received(v); break; } expectation *e; expectation *prev = NULL; - for (e = v->first_expectation; e != NULL; e = e->next) { + for (e = cq_verifier_get_first_expectation(v); e != NULL; e = e->next) { if (e->tag == ev.tag) { verify_matches(e, &ev); - if (e == v->first_expectation) v->first_expectation = e->next; + if (e == cq_verifier_get_first_expectation(v)) cq_verifier_set_first_expectation(v, e->next); if (prev != NULL) prev->next = e->next; gpr_free(e); break; @@ -253,14 +234,11 @@ void cq_verify(cq_verifier *v) { } void cq_verify_empty_timeout(cq_verifier *v, int timeout_sec) { - gpr_timespec deadline = - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_seconds(timeout_sec, GPR_TIMESPAN)); grpc_event ev; - GPR_ASSERT(v->first_expectation == NULL && "expectation queue must be empty"); + GPR_ASSERT(cq_verifier_get_first_expectation(v) == NULL && "expectation queue must be empty"); - ev = grpc_completion_queue_next(v->cq, deadline, NULL); + ev = cq_verifier_next_event(v, timeout_sec); if (ev.type != GRPC_QUEUE_TIMEOUT) { char *s = grpc_event_string(&ev); gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s); @@ -279,8 +257,8 @@ static void add(cq_verifier *v, const char *file, int line, e->line = line; e->tag = tag; e->success = success; - e->next = v->first_expectation; - v->first_expectation = e; + e->next = cq_verifier_get_first_expectation(v); + cq_verifier_set_first_expectation(v, e); } void cq_expect_completion(cq_verifier *v, const char *file, int line, void *tag, diff --git a/test/core/end2end/cq_verifier_internal.h b/test/core/end2end/cq_verifier_internal.h new file mode 100644 index 0000000000..1549608469 --- /dev/null +++ b/test/core/end2end/cq_verifier_internal.h @@ -0,0 +1,47 @@ +/* + * + * 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_TEST_CORE_END2END_CQ_VERIFIER_INTERNAL_H +#define GRPC_TEST_CORE_END2END_CQ_VERIFIER_INTERNAL_H + +#include "test/core/end2end/cq_verifier.h" + +typedef struct expectation expectation; + +expectation *cq_verifier_get_first_expectation(cq_verifier *v); + +void cq_verifier_set_first_expectation(cq_verifier *v, expectation *e); + +grpc_event cq_verifier_next_event(cq_verifier *v, int timeout_seconds); + +#endif /* GRPC_TEST_CORE_END2END_CQ_VERIFIER_INTERNAL_H */ diff --git a/test/core/end2end/cq_verifier_native.c b/test/core/end2end/cq_verifier_native.c new file mode 100644 index 0000000000..fa9a87d6e4 --- /dev/null +++ b/test/core/end2end/cq_verifier_native.c @@ -0,0 +1,73 @@ +/* + * + * Copyright 2016, 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. + * + */ + +/* This check is for testing only. */ +#ifndef GRPC_UV + +#include "test/core/end2end/cq_verifier_internal.h" + +/* the verifier itself */ +struct cq_verifier { + /* bound completion queue */ + grpc_completion_queue *cq; + /* start of expectation list */ + expectation *first_expectation; + uv_timer_t timer; +}; + +cq_verifier *cq_verifier_create(grpc_completion_queue *cq) { + cq_verifier *v = gpr_malloc(sizeof(cq_verifier)); + v->cq = cq; + cq_verifier_set_first_expectation(v,NULL); + return v; +} + +void cq_verifier_destroy(cq_verifier *v) { + cq_verify(v); + gpr_free(v); +} + +expectation *cq_verifier_get_first_expectation(cq_verifier *v) { + return v->first_expectation; +} + +void cq_verifier_set_first_expectation(cq_verifier *v, expectation *e) { + v->first_expectation = e; +} + +grpc_event cq_verifier_next_event(cq_verifier *v, int timeout_seconds) { + const gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(timeout_seconds); + return grpc_completion_queue_next(v->cq, deadline, NULL); +} + +#endif /* GRPC_UV */ diff --git a/test/core/end2end/cq_verifier_uv.c b/test/core/end2end/cq_verifier_uv.c new file mode 100644 index 0000000000..329dacf97e --- /dev/null +++ b/test/core/end2end/cq_verifier_uv.c @@ -0,0 +1,108 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#ifdef GRPC_UV + +#include + +#include + +#include "test/core/end2end/cq_verifier_internal.h" + +typedef enum timer_state { + TIMER_STARTED, + TIMER_TRIGGERED, + TIMER_CLOSED +} timer_state; + +/* the verifier itself */ +struct cq_verifier { + /* bound completion queue */ + grpc_completion_queue *cq; + /* start of expectation list */ + expectation *first_expectation; + uv_timer_t timer; +}; + +cq_verifier *cq_verifier_create(grpc_completion_queue *cq) { + cq_verifier *v = gpr_malloc(sizeof(cq_verifier)); + v->cq = cq; + v->first_expectation = NULL; + uv_timer_init(uv_default_loop(), &v->timer); + v->timer.data = (void *)TIMER_STARTED; + return v; +} + +void timer_close_cb(uv_handle_t *handle) { + handle->data = (void *)TIMER_CLOSED; +} + +void cq_verifier_destroy(cq_verifier *v) { + cq_verify(v); + uv_close((uv_handle_t *)&v->timer, timer_close_cb); + while ((timer_state)v->timer.data != TIMER_CLOSED) { + uv_run(uv_default_loop(), UV_RUN_NOWAIT); + } + gpr_free(v); +} + +expectation *cq_verifier_get_first_expectation(cq_verifier *v) { + return v->first_expectation; +} + +void cq_verifier_set_first_expectation(cq_verifier *v, expectation *e) { + v->first_expectation = e; +} + +void timer_run_cb(uv_timer_t *timer) { + timer->data = (void *)TIMER_TRIGGERED; +} + +grpc_event cq_verifier_next_event(cq_verifier *v, int timeout_seconds) { +uint64_t timeout_ms = timeout_seconds < 0 ? 0 : (uint64_t)timeout_seconds * 1000; + grpc_event ev; + v->timer.data = (void *)TIMER_STARTED; + uv_timer_start(&v->timer, timer_run_cb, timeout_ms, 0); + ev = grpc_completion_queue_next(v->cq, gpr_inf_past(GPR_CLOCK_MONOTONIC), NULL); + // Stop the loop if the timer goes off or we get a non-timeout event + while (((timer_state)v->timer.data != TIMER_TRIGGERED) && + ev.type == GRPC_QUEUE_TIMEOUT){ + uv_run(uv_default_loop(), UV_RUN_ONCE); + ev = grpc_completion_queue_next(v->cq, gpr_inf_past(GPR_CLOCK_MONOTONIC), NULL); + } + return ev; +} + +#endif /* GRPC_UV */ diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 8abb81c803..e66c52132b 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test won't work except with posix sockets enabled +#ifdef GRPC_POSIX_SOCKET + #include #include @@ -353,3 +358,11 @@ int main(int argc, char **argv) { return 0; } + +#else /* GRPC_POSIX_SOCKET */ + +int main(int argc, char **argv) { + return 1; +} + +#endif /* GRPC_POSIX_SOCKET */ diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index 89fa02517d..85be079062 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test won't work except with posix sockets enabled +#ifdef GRPC_POSIX_SOCKET + #include "test/core/end2end/end2end_tests.h" #include @@ -126,3 +131,11 @@ int main(int argc, char **argv) { return 0; } + +#else /* GRPC_POSIX_SOCKET */ + +int main(int argc, char **argv) { + return 1; +} + +#endif /* GRPC_POSIX_SOCKET */ diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index e7dfc561a1..11619b099e 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test requires posix wakeup fds +#ifdef GRPC_POSIX_WAKEUP_FD + #include "test/core/end2end/end2end_tests.h" #include @@ -119,3 +124,11 @@ int main(int argc, char **argv) { return 0; } + +#else /* GRPC_POSIX_WAKEUP_FD */ + +int main(int argc, char **argv) { + return 1; +} + +#endif /* GRPC_POSIX_WAKEUP_FD */ diff --git a/test/core/end2end/fixtures/http_proxy.c b/test/core/end2end/fixtures/http_proxy.c index eeaafe49f2..b8f046c7df 100644 --- a/test/core/end2end/fixtures/http_proxy.c +++ b/test/core/end2end/fixtures/http_proxy.c @@ -33,6 +33,8 @@ #include "test/core/end2end/fixtures/http_proxy.h" +#include "src/core/lib/iomgr/sockaddr.h" + #include #include diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 96ea82d95e..4e19b76014 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -231,8 +231,8 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, // defined in tcp_client_posix.c extern void (*grpc_tcp_client_connect_impl)( grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, - grpc_pollset_set *interested_parties, const struct sockaddr *addr, - size_t addr_len, gpr_timespec deadline); + grpc_pollset_set *interested_parties, const grpc_resolved_address *addr, + gpr_timespec deadline); static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, gpr_timespec deadline); @@ -289,7 +289,7 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, static void my_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_endpoint **ep, grpc_pollset_set *interested_parties, - const struct sockaddr *addr, size_t addr_len, + const grpc_resolved_address *addr, gpr_timespec deadline) { sched_connect(exec_ctx, closure, ep, deadline); } diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index 78b37efd37..71fe18453c 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -39,9 +39,9 @@ import hashlib FixtureOptions = collections.namedtuple( 'FixtureOptions', - 'fullstack includes_proxy dns_resolver secure platforms ci_mac tracing exclude_configs') + 'fullstack includes_proxy dns_resolver secure platforms ci_mac tracing exclude_configs exclude_iomgrs') default_unsecure_fixture_options = FixtureOptions( - True, False, True, False, ['windows', 'linux', 'mac', 'posix'], True, False, []) + True, False, True, False, ['windows', 'linux', 'mac', 'posix'], True, False, [], []) socketpair_unsecure_fixture_options = default_unsecure_fixture_options._replace(fullstack=False, dns_resolver=False) default_secure_fixture_options = default_unsecure_fixture_options._replace(secure=True) uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix']) @@ -58,7 +58,7 @@ END2END_FIXTURES = { 'h2_fd': fd_unsecure_fixture_options, 'h2_full': default_unsecure_fixture_options, 'h2_full+pipe': default_unsecure_fixture_options._replace( - platforms=['linux']), + platforms=['linux'], exclude_iomgrs=['uv']), 'h2_full+trace': default_unsecure_fixture_options._replace(tracing=True), 'h2_http_proxy': default_unsecure_fixture_options._replace(ci_mac=False), 'h2_oauth2': default_secure_fixture_options._replace(ci_mac=False), @@ -280,7 +280,7 @@ def main(): ) } print yaml.dump(json) - +p if __name__ == '__main__': main() diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index 62dc24d85a..bf6d5377a6 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test won't work except with posix sockets enabled +#ifdef GRPC_POSIX_SOCKET + #include "src/core/lib/iomgr/ev_posix.h" #include @@ -548,3 +553,11 @@ int main(int argc, char **argv) { grpc_iomgr_shutdown(); return 0; } + +#else /* GRPC_POSIX_SOCKET */ + +int main(int argc, char **argv) { + return 1; +} + +#endif /* GRPC_POSIX_SOCKET */ diff --git a/test/core/iomgr/socket_utils_test.c b/test/core/iomgr/socket_utils_test.c index 297531c44d..bb789e4c5a 100644 --- a/test/core/iomgr/socket_utils_test.c +++ b/test/core/iomgr/socket_utils_test.c @@ -31,7 +31,11 @@ * */ -#include +#include "src/core/lib/iomgr/port.h" + +// This test won't work except with posix sockets enabled +#ifdef GRPC_POSIX_SOCKET + #include "src/core/lib/iomgr/socket_utils_posix.h" #include @@ -68,3 +72,11 @@ int main(int argc, char **argv) { return 0; } + +#else /* GRPC_POSIX_SOCKET */ + +int main(int argc, char **argv) { + return 1; +} + +#endif /* GRPC_POSIX_SOCKET */ diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 42614567ca..495e648090 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test won't work except with posix sockets enabled +#ifdef GRPC_POSIX_SOCKET + #include "src/core/lib/iomgr/tcp_posix.h" #include @@ -544,3 +549,11 @@ int main(int argc, char **argv) { return 0; } + +#else /* GRPC_POSIX_SOCKET */ + +int main(int argc, char **argv) { + return 1; +} + +#endif /* GRPC_POSIX_SOCKET */ diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index b44ab89775..d1c0af55fe 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test won't work except with posix sockets enabled +#ifdef GRPC_POSIX_SOCKET + #include "src/core/lib/iomgr/tcp_server.h" #include @@ -360,3 +365,11 @@ int main(int argc, char **argv) { gpr_free(g_pollset); return 0; } + +#else /* GRPC_POSIX_SOCKET */ + +int main(int argc, char **argv) { + return 1; +} + +#endif /* GRPC_POSIX_SOCKET */ diff --git a/test/core/iomgr/timer_heap_test.c b/test/core/iomgr/timer_heap_test.c index d1cb0047f2..a68988df77 100644 --- a/test/core/iomgr/timer_heap_test.c +++ b/test/core/iomgr/timer_heap_test.c @@ -31,6 +31,11 @@ * */ +#include "src/core/lib/iomgr/port.h" + +// This test only works with the generic timer implementation +#ifdef GRPC_TIMER_USE_GENERIC + #include "src/core/lib/iomgr/timer_heap.h" #include @@ -315,3 +320,11 @@ int main(int argc, char **argv) { return 0; } + +#else /* GRPC_TIMER_USE_GENERIC */ + +int main(int argc, char **argv) { + return 1; +} + +#endif /* GRPC_TIMER_USE_GENERIC */ diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.c index a5c8c49650..d4a11c1e93 100644 --- a/test/core/util/port_server_client.c +++ b/test/core/util/port_server_client.c @@ -80,7 +80,7 @@ void grpc_free_port_using_server(char *server, int port) { grpc_httpcli_response rsp; freereq pr; char *path; - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_RUN_INNER_LOOP; grpc_closure *shutdown_closure; grpc_init(); diff --git a/test/core/util/port_uv.c b/test/core/util/port_uv.c new file mode 100644 index 0000000000..e6d37caf98 --- /dev/null +++ b/test/core/util/port_uv.c @@ -0,0 +1,58 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/lib/iomgr/port.h" +#include "test/core/util/test_config.h" +#if defined(GRPC_UV) && defined(GRPC_TEST_PICK_PORT) + +#include + +#include "test/core/util/port.h" + +int grpc_pick_unused_port(void) { + // Temporary implementation + return 4242; +} + +int grpc_pick_unused_port_or_die(void) { + int port = grpc_pick_unused_port(); + GPR_ASSERT(port > 0); + return port; +} + +void grpc_recycle_unused_port(int port) { + // Temporary implementation + (void)port; +} + +#endif /* GRPC_UV && GRPC_TEST_PICK_PORT */ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 645985d8e1..6ef586f5a5 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1011,6 +1011,7 @@ src/core/lib/iomgr/closure.c \ src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ +src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index f63ff9eb3b..19d01cd325 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -976,6 +976,7 @@ src/core/lib/iomgr/closure.c \ src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint_pair_posix.c \ +src/core/lib/iomgr/endpoint_pair_uv.c \ src/core/lib/iomgr/endpoint_pair_windows.c \ src/core/lib/iomgr/error.c \ src/core/lib/iomgr/ev_epoll_linux.c \ diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 19931246cc..87325d244d 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -83,7 +83,7 @@ _DEFAULT_TIMEOUT_SECONDS = 5 * 60 # SimpleConfig: just compile with CONFIG=config, and run the binary to test class Config(object): - def __init__(self, config, environ=None, timeout_multiplier=1, tool_prefix=[]): + def __init__(self, config, environ=None, timeout_multiplier=1, tool_prefix=[], iomgr_platform='native'): if environ is None: environ = {} self.build_config = config @@ -91,6 +91,7 @@ class Config(object): self.environ['CONFIG'] = config self.tool_prefix = tool_prefix self.timeout_multiplier = timeout_multiplier + self.iomgr_platform = iomgr_platform def job_spec(self, cmdline, timeout_seconds=_DEFAULT_TIMEOUT_SECONDS, shortname=None, environ={}, cpu_cost=1.0, flaky=False): @@ -202,6 +203,18 @@ class CLanguage(object): else: self._docker_distro, self._make_options = self._compiler_options(self.args.use_docker, self.args.compiler) + if args.iomgr_platform == "uv": + cflags = '-DGRPC_UV ' + try: + cflags += subprocess.check_output(['pkg-config', '--cflags', 'libuv']).strip() + ' ' + except subprocess.CalledProcessError: + pass + try: + ldflags = subprocess.check_output(['pkg-config', '--libs', 'libuv']).strip() + ' ' + except subprocess.CalledProcessError: + ldflags = '-luv ' + self._make_options += ['EXTRA_CPPFLAGS={}'.format(cflags), + 'EXTRA_LDLIBS={}'.format(ldflags)] def test_specs(self): out = [] @@ -218,6 +231,8 @@ class CLanguage(object): shortname_ext = '' if polling_strategy=='all' else ' GRPC_POLL_STRATEGY=%s' % polling_strategy if self.config.build_config in target['exclude_configs']: continue + if self.args.iomgr_platform in target.get('exclude_iomgrs', []): + continue if self.platform == 'windows': binary = 'vsprojects/%s%s/%s.exe' % ( 'x64/' if self.args.arch == 'x64' else '', @@ -1003,6 +1018,10 @@ argp.add_argument('--compiler', 'coreclr'], default='default', help='Selects compiler to use. Allowed values depend on the platform and language.') +argp.add_argument('--iomgr_platform', + choices=['native', 'uv'], + default='native', + help='Selects iomgr platform to build on') argp.add_argument('--build_only', default=False, action='store_const', diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index c268971937..8fe9440992 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -6111,6 +6111,7 @@ "src/core/lib/iomgr/endpoint.h", "src/core/lib/iomgr/endpoint_pair.h", "src/core/lib/iomgr/endpoint_pair_posix.c", + "src/core/lib/iomgr/endpoint_pair_uv.c", "src/core/lib/iomgr/endpoint_pair_windows.c", "src/core/lib/iomgr/error.c", "src/core/lib/iomgr/error.h", @@ -6549,6 +6550,7 @@ ], "headers": [ "test/core/end2end/cq_verifier.h", + "test/core/end2end/cq_verifier_internal.h", "test/core/end2end/fixtures/http_proxy.h", "test/core/end2end/fixtures/proxy.h", "test/core/iomgr/endpoint_tests.h", @@ -6566,6 +6568,9 @@ "src": [ "test/core/end2end/cq_verifier.c", "test/core/end2end/cq_verifier.h", + "test/core/end2end/cq_verifier_internal.h", + "test/core/end2end/cq_verifier_native.c", + "test/core/end2end/cq_verifier_uv.c", "test/core/end2end/fixtures/http_proxy.c", "test/core/end2end/fixtures/http_proxy.h", "test/core/end2end/fixtures/proxy.c", @@ -6586,6 +6591,7 @@ "test/core/util/port_posix.c", "test/core/util/port_server_client.c", "test/core/util/port_server_client.h", + "test/core/util/port_uv.c", "test/core/util/port_windows.c", "test/core/util/slice_splitter.c", "test/core/util/slice_splitter.h" diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 6500c4aac3..3d80d013ca 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -11,6 +11,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -32,6 +33,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -53,6 +55,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -74,6 +77,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -95,6 +99,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -116,6 +121,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -137,6 +143,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -158,6 +165,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -179,6 +187,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -200,6 +209,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -221,6 +231,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -242,6 +253,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -263,6 +275,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -284,6 +297,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -305,6 +319,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -326,6 +341,7 @@ ], "cpu_cost": 30, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -347,6 +363,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -368,6 +385,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -389,6 +407,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -410,6 +429,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -430,6 +450,9 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], "flaky": false, "gtest": false, "language": "c", @@ -450,6 +473,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -468,6 +492,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -485,6 +510,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -504,6 +530,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -523,6 +550,7 @@ ], "cpu_cost": 1.5, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -542,6 +570,7 @@ ], "cpu_cost": 1.5, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -561,6 +590,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -581,6 +611,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -602,6 +633,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -623,6 +655,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -644,6 +677,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -665,6 +699,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -686,6 +721,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -707,6 +743,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -728,6 +765,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -749,6 +787,7 @@ ], "cpu_cost": 30, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -770,6 +809,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -791,6 +831,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -812,6 +853,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -833,6 +875,7 @@ ], "cpu_cost": 7, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -854,6 +897,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -875,6 +919,7 @@ ], "cpu_cost": 10, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -896,6 +941,7 @@ ], "cpu_cost": 10, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -917,6 +963,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -938,6 +985,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -959,6 +1007,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -980,6 +1029,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1001,6 +1051,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1022,6 +1073,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1043,6 +1095,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1064,6 +1117,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1085,6 +1139,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1106,6 +1161,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1127,6 +1183,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1147,6 +1204,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1167,6 +1225,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1188,6 +1247,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1209,6 +1269,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1230,6 +1291,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1251,6 +1313,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1272,6 +1335,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1292,6 +1356,7 @@ ], "cpu_cost": 0.5, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1309,6 +1374,7 @@ ], "cpu_cost": 0.5, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1327,6 +1393,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1348,6 +1415,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1369,6 +1437,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1390,6 +1459,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1411,6 +1481,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1432,6 +1503,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1453,6 +1525,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": true, "gtest": false, "language": "c", @@ -1474,6 +1547,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1495,6 +1569,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1516,6 +1591,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": true, "gtest": false, "language": "c", @@ -1537,6 +1613,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1558,6 +1635,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1579,6 +1657,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1600,6 +1679,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1621,6 +1701,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1642,6 +1723,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1663,6 +1745,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1684,6 +1767,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1705,6 +1789,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1726,6 +1811,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1747,6 +1833,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1768,6 +1855,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1788,6 +1876,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1807,6 +1896,9 @@ ], "cpu_cost": 0.5, "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], "flaky": false, "gtest": false, "language": "c", @@ -1826,6 +1918,9 @@ ], "cpu_cost": 0.2, "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], "flaky": false, "gtest": false, "language": "c", @@ -1845,6 +1940,9 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], "flaky": false, "gtest": false, "language": "c", @@ -1865,6 +1963,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1886,6 +1985,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1907,6 +2007,9 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], "flaky": false, "gtest": false, "language": "c", @@ -1928,6 +2031,9 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [ + "uv" + ], "flaky": false, "gtest": false, "language": "c", @@ -1949,6 +2055,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1970,6 +2077,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -1990,6 +2098,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2009,6 +2118,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2029,6 +2139,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2050,6 +2161,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2071,6 +2183,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2092,6 +2205,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2113,6 +2227,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2134,6 +2249,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2154,6 +2270,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2174,6 +2291,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2195,6 +2313,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2216,6 +2335,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2237,6 +2357,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2258,6 +2379,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2279,6 +2401,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2300,6 +2423,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2321,6 +2445,7 @@ ], "cpu_cost": 0.5, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2342,6 +2467,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2363,6 +2489,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2384,6 +2511,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2405,6 +2533,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2426,6 +2555,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2447,6 +2577,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", @@ -2468,6 +2599,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2488,6 +2620,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", @@ -2508,6 +2641,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2529,6 +2663,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2549,6 +2684,7 @@ ], "cpu_cost": 0.5, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", @@ -2569,6 +2705,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2589,6 +2726,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", @@ -2609,6 +2747,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2629,6 +2768,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2649,6 +2789,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2670,6 +2811,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c++", @@ -2690,6 +2832,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2710,6 +2853,7 @@ ], "cpu_cost": 100, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": true, "language": "c++", @@ -2731,6 +2875,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c89", @@ -2752,6 +2897,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2773,6 +2919,7 @@ ], "cpu_cost": 0.2, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2794,6 +2941,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2815,6 +2963,7 @@ ], "cpu_cost": 0.2, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2836,6 +2985,7 @@ ], "cpu_cost": 0.2, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2857,6 +3007,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2878,6 +3029,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2899,6 +3051,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2920,6 +3073,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2941,6 +3095,7 @@ ], "cpu_cost": 1.0, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", @@ -2961,6 +3116,7 @@ ], "cpu_cost": 0.1, "exclude_configs": [], + "exclude_iomgrs": [], "flaky": false, "gtest": false, "language": "c", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 9a70cd4bb2..b62d50e6e0 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -565,6 +565,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 0d2f0cc600..85520c090f 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -157,6 +157,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 3f9eb3530e..fca3bbf5a3 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -551,6 +551,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index dbcfba91b9..587eb38ee9 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -142,6 +142,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 927e2028b6..8b62411204 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -507,6 +507,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 1c05f6b3f1..e2b52e1ae1 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -61,6 +61,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index d58264654d..8397b3b16f 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -176,6 +176,7 @@ + @@ -290,6 +291,10 @@ + + + + @@ -310,6 +315,8 @@ + + @@ -352,6 +359,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index baa37f91b9..8eb177911e 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -19,6 +19,12 @@ test\core\end2end + + test\core\end2end + + + test\core\end2end + test\core\end2end\fixtures @@ -49,6 +55,9 @@ test\core\util + + test\core\util + test\core\util @@ -112,6 +121,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -446,6 +458,9 @@ test\core\end2end + + test\core\end2end + test\core\end2end\fixtures diff --git a/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj b/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj index 04d1e584b5..d38045db91 100644 --- a/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj @@ -148,6 +148,7 @@ + @@ -163,6 +164,10 @@ + + + + @@ -183,6 +188,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters index 0f7072aa61..00615fbf9e 100644 --- a/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util_unsecure/grpc_test_util_unsecure.vcxproj.filters @@ -4,6 +4,12 @@ test\core\end2end + + test\core\end2end + + + test\core\end2end + test\core\end2end\fixtures @@ -34,6 +40,9 @@ test\core\util + + test\core\util + test\core\util @@ -45,6 +54,9 @@ test\core\end2end + + test\core\end2end + test\core\end2end\fixtures diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 5d8b99013f..d3b3f1895d 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -475,6 +475,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index dfe01382c0..422833190c 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -64,6 +64,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr -- cgit v1.2.3