Remove the hack

pull/21607/head
Lidi Zheng 5 years ago
parent 8d81314fc8
commit 3a6eaf7de7
  1. 14
      src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi
  2. 2
      src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi
  3. 3
      src/python/grpcio_tests/tests_aio/unit/channel_argument_test.py

@ -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)

@ -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)

@ -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():

Loading…
Cancel
Save