def __init__(self,
                 method_wrapper: "SimpleMPRPServer",
                 loop: Optional[asyncio.AbstractEventLoop]=None,
                 auth: List[Tuple[str, str]]=None,
                 timeout: Optional[float] = 180.0,
                 debug: bool=False,
                 compreser: Optional[str]=None
                 ):
        """实例化一个协议对象,用于管理一个连接.

        初始化主要是设置成员的值,包括一些用于管理状态的变量和容器

        Parameters:
            method_wrapper (SimpleMPRPServer): - pmprpc服务的实例

            loop (Optional[asyncio.AbstractEventLoop]): - 事件循环

            auth (Optional[List[Tuple[str, str]]]): - 合法的认证信息,保存在一个列表中,
            以username,password的成对形式保存

            timeout (Optional[float]): - 过期时间,如果timeout为None则不会因过期而关闭

            debug (bool): - 是否使用debug模式,默认为否

            compreser(Optional[str]): - 是否使用压缩工具压缩传输信息,以及压缩工具是什么,默认为不使用.

        """
        # public
        self.auth = auth
        self.timeout = timeout
        self.debug = debug
        self.method_wrapper = method_wrapper
        self.tasks = {}

        if compreser is not None:
            _compreser = self.COMPRESERS.get(compreser)
            if _compreser is not None:
                self.compreser = _compreser
            else:
                raise RuntimeError("compreser unsupport")
        else:
            self.compreser = None
        # protected
        self._handlertask = None  # 执行的任务循环
        self._loop = loop or asyncio.get_event_loop()
        self._last_response_time = time()  # 上一次响应的过期时间
        self._timeout_handler = None
        self._transport = None
        self._remote_host = None
        self._extra = None
        self._stream_writer = None
        self._stream_reader = None
        self._client_connected_cb = None
        self._over_ssl = False

        self._paused = False
        self._drain_waiter = None
        self._connection_lost = False
def __init__ ( self , method_wrapper : "SimpleMPRPServer" , loop : Optional [ asyncio . AbstractEventLoop ] = None , auth : List [ Tuple [ str , str ] ] = None , timeout : Optional [ float ] = 180.0 , debug : bool = False , compreser : Optional [ str ] = None ) : self . auth = auth self . timeout = timeout self . debug = debug self . method_wrapper = method_wrapper self . tasks = { } if compreser is not None : _compreser = self . COMPRESERS . get ( compreser ) if _compreser is not None : self . compreser = _compreser else : raise RuntimeError ( "compreser unsupport" ) else : self . compreser = None self . _handlertask = None self . _loop = loop or asyncio . get_event_loop ( ) self . _last_response_time = time ( ) self . _timeout_handler = None self . _transport = None self . _remote_host = None self . _extra = None self . _stream_writer = None self . _stream_reader = None self . _client_connected_cb = None self . _over_ssl = False self . _paused = False self . _drain_waiter = None self . _connection_lost = False
实例化一个协议对象,用于管理一个连接.

        初始化主要是设置成员的值,包括一些用于管理状态的变量和容器

        Parameters:
            method_wrapper (SimpleMPRPServer): - pmprpc服务的实例

            loop (Optional[asyncio.AbstractEventLoop]): - 事件循环

            auth (Optional[List[Tuple[str, str]]]): - 合法的认证信息,保存在一个列表中,
            以username,password的成对形式保存

            timeout (Optional[float]): - 过期时间,如果timeout为None则不会因过期而关闭

            debug (bool): - 是否使用debug模式,默认为否

            compreser(Optional[str]): - 是否使用压缩工具压缩传输信息,以及压缩工具是什么,默认为不使用.