| 324 | return conn |
| 325 | |
| 326 | def _get(self, key): |
| 327 | try: |
| 328 | conns = self._conns[key] |
| 329 | except KeyError: |
| 330 | return None, None |
| 331 | t1 = self._loop.time() |
| 332 | while conns: |
| 333 | transport, proto, t0 = conns.pop() |
| 334 | if transport is not None and proto.is_connected(): |
| 335 | if t1 - t0 > self._keepalive_timeout: |
| 336 | transport.close() |
| 337 | transport = None |
| 338 | else: |
| 339 | if not conns: |
| 340 | # The very last connection was reclaimed: drop the key |
| 341 | del self._conns[key] |
| 342 | return transport, proto |
| 343 | # No more connections: drop the key |
| 344 | del self._conns[key] |
| 345 | return None, None |
| 346 | |
| 347 | def _release(self, key, req, transport, protocol, *, should_close=False): |
| 348 | if self._closed: |