Skip to content

Commit

Permalink
better ClientResponse.release method
Browse files Browse the repository at this point in the history
  • Loading branch information
popravich committed Jul 4, 2014
1 parent 750a095 commit 2e6b6e7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,14 @@ def close(self, force=False):

@asyncio.coroutine
def release(self):
yield from self.read()
force = False
try:
while True:
yield from self.content.read()
except Exception as exc:
force = not isinstance(exc, aiohttp.EofStream)
finally:
self.close(force=force)

@asyncio.coroutine
def wait_for_close(self):
Expand Down

1 comment on commit 2e6b6e7

@popravich
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is regarding #96

Please sign in to comment.