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

Misc client fixes #933

Merged
merged 5 commits into from
Oct 14, 2016
Merged

Misc client fixes #933

merged 5 commits into from
Oct 14, 2016

Conversation

jwilm
Copy link
Contributor

@jwilm jwilm commented Oct 13, 2016

This includes improvements to client error handling, keep-alive strategy, and fixes a busy-loop. Sorry for putting these all in one PR, but they build on each other and it's still relatively short. Probably makes sense to review commit at a time.

Previously, the connection would be kept alive if there was a connect
error. Now it's closed immediately.
It's possible that a connection will be closed and the only way to find
out is by doing a read. The keep-alive state (State::Init + Next_::Wait)
now tries to read on readable. In the case of EOF, it returns state
closed. If bytes are actually available, it's a connection error, and
the connection is closed. Otherwise, it's just a spurious wakeup.
The previous keep-alive strategy was to cycle connections in a
round-robin style. However, that will always keep more connections
around than are needed. This new strategy will allow extra connections
to expire when only a few are needed. This is accomplished by prefering
to reuse a connection that was just released to the pool over one that
has been there for a long time.
We encountered some issues where the `Conn::ready()` would busy loop on
reads. Previously, the `ConnInner::can_read_more()` would not consider
whether the previous read got a WouldBlock error, and it didn't consider
whether the transport was blocked. Accounting for this additional state
fixes the busy loop problem.
@seanmonstar seanmonstar merged commit 7de6f2b into hyperium:master Oct 14, 2016
@jwilm jwilm deleted the misc-client-fixes branch October 14, 2016 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants