MCPcopy
hub / github.com/aio-libs/aiohttp / close

Method close

aiohttp/connector.py:223–250  ·  view source on GitHub ↗

Close all opened transports.

(self)

Source from the content-addressed store, hash-verified

221 ceil(now + self._keepalive_timeout), self._cleanup)
222
223 def close(self):
224 """Close all opened transports."""
225 ret = asyncio.Future(loop=self._loop)
226 ret.set_result(None)
227 if self._closed:
228 return ret
229 self._closed = True
230
231 try:
232 if hasattr(self._loop, 'is_closed'):
233 if self._loop.is_closed():
234 return ret
235
236 for key, data in self._conns.items():
237 for transport, proto, t0 in data:
238 transport.close()
239
240 for transport in chain(*self._acquired.values()):
241 transport.close()
242
243 if self._cleanup_handle:
244 self._cleanup_handle.cancel()
245
246 finally:
247 self._conns.clear()
248 self._acquired.clear()
249 self._cleanup_handle = None
250 return ret
251
252 @property
253 def closed(self):

Callers 14

__del__Method · 0.95
test_closeMethod · 0.95
test_getMethod · 0.95
test_get_expiredMethod · 0.95
test_releaseMethod · 0.95
test_cleanup2Method · 0.95
test_cleanup3Method · 0.95
test_close_twiceMethod · 0.95
goMethod · 0.95

Calls 1

closeMethod · 0.45

Tested by 13

test_closeMethod · 0.76
test_getMethod · 0.76
test_get_expiredMethod · 0.76
test_releaseMethod · 0.76
test_cleanup2Method · 0.76
test_cleanup3Method · 0.76
test_close_twiceMethod · 0.76
goMethod · 0.76
test_limit_propertyMethod · 0.76