@
so1n 不是,是想实现类似 python protocol 一样,连接创建和断开自动触发
```
class RpcClient(asyncio.Protocol):
def __init__(self, service_id):
self.transport = None
self.peername = None
def connection_made(self, transport):
utils_rpc_client_mgr_inst.add_rpc_client(self)
logging.info(f'rpc_client_connection_made to {self.peername}')
def connection_lost(self, exc):
from utils import rpc_client_mgr_inst as utils_rpc_client_mgr_inst
logging.error(f'rpc_client_connection_lost to {self.peername}')
utils_rpc_client_mgr_inst.del_rpc_client(self)
```