Use linux kernel version 2.6.37 to decide whether to use TCP_USER_TIMEOUT or not

pull/16419/head
Yash Tibrewal 6 years ago
parent 2f8e60a773
commit ecee4ac703
  1. 6
      src/core/lib/iomgr/port.h
  2. 4
      src/core/lib/iomgr/socket_utils_common_posix.cc

@ -77,6 +77,12 @@
#define GRPC_LINUX_SOCKETUTILS 1
#endif
#endif
#include <linux/version.h>
#ifdef LINUX_VERSION_CODE
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
#define GRPC_HAVE_TCP_USER_TIMEOUT
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) */
#endif /* LINUX_VERSION_CODE */
#ifndef __GLIBC__
#define GRPC_LINUX_EPOLL 1
#define GRPC_LINUX_EPOLL_CREATE1 1

@ -226,7 +226,7 @@ grpc_error* grpc_set_socket_low_latency(int fd, int low_latency) {
/* Set TCP_USER_TIMEOUT */
grpc_error* grpc_set_socket_tcp_user_timeout(int fd, int val) {
#ifdef GPR_LINUX
#ifdef GRPC_HAVE_TCP_USER_TIMEOUT
int newval;
socklen_t len;
if (val == 0) {
@ -242,7 +242,7 @@ grpc_error* grpc_set_socket_tcp_user_timeout(int fd, int val) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Failed to set TCP_USER_TIMEOUT");
}
#endif /* GPR_LINUX */
#endif /* GRPC_HAVE_TCP_USER_TIMEOUT */
return GRPC_ERROR_NONE;
}

Loading…
Cancel
Save