Skip to content

Commit

Permalink
don't close the connection on exceptions (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
thehesiod authored and Nikolay Kim committed Feb 1, 2017
1 parent 84929bc commit 7107386
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,12 @@ class _RequestContextManager(_BaseRequestContextManager):
if PY_35:
@asyncio.coroutine
def __aexit__(self, exc_type, exc, tb):
if exc_type is not None:
self._resp.close()
else:
yield from self._resp.release()
# We're basing behavior on the exception as it can be caused by
# user code unrelated to the status of the connection. If you
# would like to close a connection you must do that
# explicitly. Otherwise connection error handling should kick in
# and close/recycle the connection as required.
yield from self._resp.release()


class _WSRequestContextManager(_BaseRequestContextManager):
Expand Down

0 comments on commit 7107386

Please sign in to comment.