Handle a connection from the arbiter. Each connection can send multiple requests.
(self, reader, writer)
| 286 | await asyncio.sleep(self.cfg.dirty_timeout / 2.0) |
| 287 | |
| 288 | async def handle_connection(self, reader, writer): |
| 289 | """ |
| 290 | Handle a connection from the arbiter. |
| 291 | |
| 292 | Each connection can send multiple requests. |
| 293 | """ |
| 294 | self.log.debug("New connection from arbiter") |
| 295 | |
| 296 | try: |
| 297 | while self.alive: |
| 298 | try: |
| 299 | message = await DirtyProtocol.read_message_async(reader) |
| 300 | except asyncio.IncompleteReadError: |
| 301 | # Connection closed |
| 302 | break |
| 303 | |
| 304 | # Handle the request - pass writer for streaming support |
| 305 | await self.handle_request(message, writer) |
| 306 | except Exception as e: |
| 307 | self.log.error("Connection error: %s", e) |
| 308 | finally: |
| 309 | writer.close() |
| 310 | try: |
| 311 | await writer.wait_closed() |
| 312 | except Exception: |
| 313 | pass |
| 314 | |
| 315 | async def handle_request(self, message, writer): |
| 316 | """ |
nothing calls this directly
no test coverage detected