From 9b058aa157c4905d61d203289d8ab8943cad3bf6 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Mon, 28 Oct 2019 15:50:39 -0700 Subject: [PATCH] =?UTF-8?q?=E5=BF=83=E3=82=88=E3=80=82=E5=BF=83=E3=82=88?= =?UTF-8?q?=E3=80=82=E3=81=93=E3=81=93=E3=81=AF=E3=80=81=E6=82=AA=E3=81=84?= =?UTF-8?q?=E6=89=80=E3=82=88=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/python/grpcio_tests/tests/unit/_reconnect_test.py | 2 +- src/python/grpcio_tests/tests/unit/framework/common/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio_tests/tests/unit/_reconnect_test.py b/src/python/grpcio_tests/tests/unit/_reconnect_test.py index 8d7fd38868b..b19a5b5d76f 100644 --- a/src/python/grpcio_tests/tests/unit/_reconnect_test.py +++ b/src/python/grpcio_tests/tests/unit/_reconnect_test.py @@ -42,7 +42,7 @@ class ReconnectTest(unittest.TestCase): 'UnaryUnary': grpc.unary_unary_rpc_method_handler(_handle_unary_unary) }) - options=(('grpc.so_reuseport', 0),) + options=(('grpc.so_reuseport', 1),) with bound_socket() as (host, port): addr = '{}:{}'.format(host, port) server = grpc.server(server_pool, (handler,), options=options) diff --git a/src/python/grpcio_tests/tests/unit/framework/common/__init__.py b/src/python/grpcio_tests/tests/unit/framework/common/__init__.py index e1979c96b09..488c712c704 100644 --- a/src/python/grpcio_tests/tests/unit/framework/common/__init__.py +++ b/src/python/grpcio_tests/tests/unit/framework/common/__init__.py @@ -15,7 +15,6 @@ import contextlib import socket - def get_socket(bind_address='localhost', listen=True, sock_options=(socket.SO_REUSEPORT,)): @@ -49,6 +48,7 @@ def get_socket(bind_address='localhost', sock.listen(1) return bind_address, sock.getsockname()[1], sock except socket.error: + sock.close() continue raise RuntimeError("Failed to bind to {} with sock_options {}".format( bind_address, sock_options))