Close expired keepalive connections.
(self)
| 313 | self.enqueue_req(conn) |
| 314 | |
| 315 | def murder_keepalived(self): |
| 316 | """Close expired keepalive connections.""" |
| 317 | now = time.monotonic() |
| 318 | while self.keepalived_conns: |
| 319 | conn = self.keepalived_conns[0] |
| 320 | delta = conn.timeout - now |
| 321 | if delta > 0: |
| 322 | break |
| 323 | |
| 324 | # Connection has timed out |
| 325 | self.keepalived_conns.popleft() |
| 326 | try: |
| 327 | self.poller.unregister(conn.sock) |
| 328 | except (OSError, KeyError, ValueError): |
| 329 | pass # Already unregistered |
| 330 | self.nr_conns -= 1 |
| 331 | conn.close() |
| 332 | |
| 333 | def murder_pending(self): |
| 334 | """Close expired pending connections (waiting for initial data).""" |