Skip to content
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

Merged
merged 16 commits into from
Oct 21, 2016
Merged

Conversation

springmaple
Copy link
Contributor

@springmaple springmaple commented Oct 20, 2016

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

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • Add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new entry to CHANGES.rst
    • Choose any open position to avoid merge conflicts with other PRs.
    • Add a link to the issue you are fixing (if any) using #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.

@codecov-io
Copy link

codecov-io commented Oct 20, 2016

Current coverage is 98.51% (diff: 100%)

Merging #1323 into master will increase coverage by <.01%

@@             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          

Powered by Codecov. Last update f8e2425...e865de2

@springmaple springmaple changed the base branch from 0.22 to master October 20, 2016 08:17
@springmaple
Copy link
Contributor Author

I need advice whether ClientDisconnectedError("Connection closed") is the appropriate error type to be used.

@asvetlov
Copy link
Member

Looks good.
Please go ahead.

@@ -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):
Copy link
Member

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.

@asvetlov asvetlov merged commit b97a400 into aio-libs:master Oct 21, 2016
@asvetlov
Copy link
Member

Thanks!

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants