-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a function to notify StreamReader when connection from ClientSession is closed. #1323
Conversation
Current coverage is 98.51% (diff: 100%)@@ master #1323 diff @@
==========================================
Files 29 29
Lines 6516 6522 +6
Methods 0 0
Messages 0 0
Branches 1094 1095 +1
==========================================
+ Hits 6419 6425 +6
Misses 47 47
Partials 50 50
|
I need advice whether |
Looks good. |
@@ -96,3 +96,30 @@ def test_ctx_manager_is_coroutine(): | |||
with aiohttp.ClientSession(loop=loop) as session: | |||
async with await session.post(server.make_url('/'), data=data) as resp: | |||
assert resp.status == 200 | |||
|
|||
|
|||
async def test_iter_error_on_conn_close(test_server, loop): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you change is not Python 3.5 specific and could be executed by Python 3.4 the test should be placed in tests/test_client_functional.py
and written with old-styled asyncio.coroutine
and yield from
.
…nal.py' and fix unhandled exception.
Thanks! |
What do these changes do?
Raise
ClientDisconnectedError('Connection closed')
to StreamReader iteration when connection is forced close programmatically.Are there changes in behavior for the user?
Currently the iteration will stuck for a long time after connection is forced close. The iteration will raise a
ClientDisconnectedError
immediately after connection is forced close before EOF is read with this change.Related issue number
#1310
Checklist
CONTRIBUTORS.txt
CHANGES.rst
#isuue_number
format at the end of changelog message. Use Pull Request number if there are no issues for PR or PR covers the issue only partially.