aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/tcp_client_posix.cc
diff options
context:
space:
mode:
authorGravatar Guantao Liu <guantaol@google.com>2018-11-09 16:22:21 -0800
committerGravatar Guantao Liu <guantaol@google.com>2018-11-09 16:22:21 -0800
commit4f9bdf4e06465205dc13715b07b428a2cc4a87c2 (patch)
tree5f52ee6e817796a1aebdc0c2a386fe106f97463e /src/core/lib/iomgr/tcp_client_posix.cc
parent6a368df7ab746c973d41cf0b53494577ee1874f3 (diff)
Enable SO_REUSEADDR in client sockets
Diffstat (limited to 'src/core/lib/iomgr/tcp_client_posix.cc')
-rw-r--r--src/core/lib/iomgr/tcp_client_posix.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/tcp_client_posix.cc b/src/core/lib/iomgr/tcp_client_posix.cc
index 8553ed0db4..0bff74e88b 100644
--- a/src/core/lib/iomgr/tcp_client_posix.cc
+++ b/src/core/lib/iomgr/tcp_client_posix.cc
@@ -76,6 +76,8 @@ static grpc_error* prepare_socket(const grpc_resolved_address* addr, int fd,
if (!grpc_is_unix_socket(addr)) {
err = grpc_set_socket_low_latency(fd, 1);
if (err != GRPC_ERROR_NONE) goto error;
+ err = grpc_set_socket_reuse_addr(fd, 1);
+ if (err != GRPC_ERROR_NONE) goto error;
err = grpc_set_socket_tcp_user_timeout(fd, channel_args,
true /* is_client */);
if (err != GRPC_ERROR_NONE) goto error;