(self, sock, n)
| 210 | self.backend_sock.close() |
| 211 | |
| 212 | async def _read(self, sock, n): |
| 213 | read_task = asyncio.ensure_future( |
| 214 | self.loop.sock_recv(sock, n)) |
| 215 | conn_event_task = asyncio.ensure_future( |
| 216 | self.connectivity_loss.wait()) |
| 217 | |
| 218 | try: |
| 219 | await asyncio.wait( |
| 220 | [read_task, conn_event_task], |
| 221 | return_when=asyncio.FIRST_COMPLETED) |
| 222 | |
| 223 | if self.connectivity_loss.is_set(): |
| 224 | return None |
| 225 | else: |
| 226 | return read_task.result() |
| 227 | finally: |
| 228 | if not self.loop.is_closed(): |
| 229 | if not read_task.done(): |
| 230 | read_task.cancel() |
| 231 | if not conn_event_task.done(): |
| 232 | conn_event_task.cancel() |
| 233 | |
| 234 | async def _write(self, sock, data): |
| 235 | write_task = asyncio.ensure_future( |
no test coverage detected