diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi index 1253a123189..66ca0b16041 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi @@ -122,22 +122,8 @@ cdef grpc_error* asyncio_socket_listen(grpc_custom_socket* grpc_socket) with gil return grpc_error_none() -cdef list _socket_options_list = [] -cdef str _SOCKET_OPT_SO_REUSEPORT = 'grpc.so_reuseport' - -cdef _apply_socket_options(tuple options): - if options is None: - options = () - - for key, value in options: - if key == _SOCKET_OPT_SO_REUSEPORT: - _socket_options_list.append(value) - - def _asyncio_apply_socket_options(object s): s.setsockopt(native_socket.SOL_SOCKET, native_socket.SO_REUSEADDR, 1) - if _socket_options_list.pop(0): - s.setsockopt(native_socket.SOL_SOCKET, native_socket.SO_REUSEPORT, 1) s.setsockopt(native_socket.IPPROTO_TCP, native_socket.TCP_NODELAY, True) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi index 33e6859e50b..992e3797881 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi @@ -260,8 +260,6 @@ cdef class AioServer: def __init__(self, loop, thread_pool, generic_handlers, interceptors, options, maximum_concurrent_rpcs, compression): - # Notify IO manager about the socket options - _apply_socket_options(options) # NOTE(lidiz) Core objects won't be deallocated automatically. # If AioServer.shutdown is not called, those objects will leak. self._server = Server(options) diff --git a/src/python/grpcio_tests/tests_aio/unit/channel_argument_test.py b/src/python/grpcio_tests/tests_aio/unit/channel_argument_test.py index 27d40934da2..b53108b1f57 100644 --- a/src/python/grpcio_tests/tests_aio/unit/channel_argument_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/channel_argument_test.py @@ -73,7 +73,7 @@ async def test_if_reuse_port_enabled(server: aio.Server): await server.start() try: - another_socket = socket.socket(family=socket.AF_INET6) + another_socket = socket.socket(family=socket.AF_INET) another_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) another_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) another_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True) @@ -92,6 +92,7 @@ class TestChannelArgument(AioTestBase): async def setUp(self): random.seed(_RANDOM_SEED) + @unittest.skip('https://github.com/grpc/grpc/issues/20667') async def test_server_so_reuse_port_is_set_properly(self): async def test_body():