Skip to content

Commit

Permalink
Close idle keep-alive connections on shutdown (#1222)
Browse files Browse the repository at this point in the history
Fixing #1221
  • Loading branch information
tahajahangir authored and asvetlov committed Sep 29, 2016
1 parent 94e0fb6 commit a93d9c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aiohttp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ def shutdown(self, timeout=15.0):
return
self._closing = True

if timeout:
if self._request_count > 1 and not self._reading_request:
# force-close idle keep-alive connections
self._request_handler.cancel()
elif timeout:
canceller = self._loop.call_later(timeout,
self._request_handler.cancel)
with suppress(asyncio.CancelledError):
Expand Down

0 comments on commit a93d9c2

Please sign in to comment.