Ejemplo n.º 1
0
 async def read(self, n: int) -> bytes:
     self.logger.debug("Waiting for %s bytes from %s", n, self.remote)
     try:
         data = await asyncio.wait_for(self.reader.readexactly(n), self.conn_idle_timeout)
     except (asyncio.IncompleteReadError, ConnectionResetError):
         raise PeerConnectionLost("EOF reading from stream")
     return data
Ejemplo n.º 2
0
 async def read(self, n):
     self.logger.debug("Waiting for {} bytes from {}".format(
         n, self.remote))
     try:
         data = await asyncio.wait_for(self.reader.readexactly(n),
                                       self.conn_idle_timeout)
     except (asyncio.IncompleteReadError, ConnectionResetError):
         self.logger.debug("EOF reading from {}'s stream".format(
             self.remote))
         raise PeerConnectionLost()
     return data