async def _one_read(self) -> bool: packs = await self._conn.read_bytes() if packs is None: return False for opt, body in Pack.unpack(packs): if not self.parse_body(body, opt): return False return True
async def _one_read(self) -> bool: packs = await self._conn.read_bytes() if packs is None: return False len_pack, len_header, ver, opt, _ = Header.unpack(packs) body = packs[len_header:] if ver == 2 and opt == Opt.SEND_MSG_REPLY: # v2 协议有混合,可能不成熟吧 packs = zlib.decompress(body) for opt, body in Pack.unpack(packs): if not await self.parse_body(body, opt): return False return True else: return await self.parse_body(body, opt)