Cosmetic changes

pull/21607/head
Lidi Zheng 5 years ago
parent 3a6eaf7de7
commit cc19670bb9
  1. 2
      src/python/grpcio/grpc/_cython/_cygrpc/aio/iomgr/iomgr.pyx.pxi
  2. 28
      src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi

@ -123,6 +123,8 @@ cdef grpc_error* asyncio_socket_listen(grpc_custom_socket* grpc_socket) with gil
def _asyncio_apply_socket_options(object s):
# TODO(https://github.com/grpc/grpc/issues/20667)
# Connects the so_reuse_port option to channel arguments
s.setsockopt(native_socket.SOL_SOCKET, native_socket.SO_REUSEADDR, 1)
s.setsockopt(native_socket.IPPROTO_TCP, native_socket.TCP_NODELAY, True)

@ -227,21 +227,17 @@ async def _handle_rpc(list generic_handlers, RPCState rpc_state, object loop):
# TODO(lidiz) return unimplemented error to client side
raise NotImplementedError()
try:
# TODO(lidiz) extend to all 4 types of RPC
if not method_handler.request_streaming and method_handler.response_streaming:
await _handle_unary_stream_rpc(method_handler,
rpc_state,
loop)
elif not method_handler.request_streaming and not method_handler.response_streaming:
await _handle_unary_unary_rpc(method_handler,
rpc_state,
loop)
else:
raise NotImplementedError()
except Exception as e:
_LOGGER.exception(e)
raise
# TODO(lidiz) extend to all 4 types of RPC
if not method_handler.request_streaming and method_handler.response_streaming:
await _handle_unary_stream_rpc(method_handler,
rpc_state,
loop)
elif not method_handler.request_streaming and not method_handler.response_streaming:
await _handle_unary_unary_rpc(method_handler,
rpc_state,
loop)
else:
raise NotImplementedError()
class _RequestCallError(Exception): pass
@ -473,7 +469,7 @@ cdef class AioServer:
If the Cython representation is deallocated without underlying objects
freed, raise an RuntimeError.
"""
# NOTE(lidiz) if users create server, and then dealloc it immediately.
# TODO(lidiz) if users create server, and then dealloc it immediately.
# There is a potential memory leak of created Core server.
if self._status != AIO_SERVER_STATUS_STOPPED:
_LOGGER.warn(

Loading…
Cancel
Save