| 456 | slf.on_data.set_result(bytes(slf.buf[:nsize])) |
| 457 | |
| 458 | class ClientProtoSecond(asyncio.Protocol): |
| 459 | def __init__(self, on_data, on_eof): |
| 460 | self.on_data = on_data |
| 461 | self.on_eof = on_eof |
| 462 | self.con_made_cnt = 0 |
| 463 | |
| 464 | def connection_made(self, tr): |
| 465 | nonlocal client_con_made_calls |
| 466 | client_con_made_calls += 1 |
| 467 | |
| 468 | def data_received(self, data): |
| 469 | self.on_data.set_result(data) |
| 470 | |
| 471 | def eof_received(self): |
| 472 | self.on_eof.set_result(True) |
| 473 | |
| 474 | async def client(addr): |
| 475 | await asyncio.sleep(0.5) |