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

Allow saving multiple streams with the same address to the pool #110

Closed
cfal opened this issue Jul 4, 2020 · 2 comments · Fixed by #133
Closed

Allow saving multiple streams with the same address to the pool #110

cfal opened this issue Jul 4, 2020 · 2 comments · Fixed by #133

Comments

@cfal
Copy link
Contributor

cfal commented Jul 4, 2020

It would be useful to be able to save multiple streams to the same address in the connection pool - for example, when doing chunked downloading via Range header, multiple connections can be used and reused.

@cfal cfal changed the title Allow saving multiple streams to the same address to the pool Allow saving multiple streams with the same address to the pool Jul 4, 2020
@cfal
Copy link
Contributor Author

cfal commented Jul 8, 2020

Would a PR for this be accepted? I have a small change that does this but removed the MAX_IDLE_CONNECTIONS constant and added constants MAX_IDLE_HOSTS and MAX_IDLE_CONNECTIONS_PER_HOST. Could set this to 100 and 1 respectively by default to keep the behavior the same. But then it could also be nice to make these values configurable.

@algesten
Copy link
Owner

algesten commented Jul 8, 2020

I think that's a good change! PR sounds good!

@jsha jsha closed this as completed in #133 Sep 13, 2020
jsha pushed a commit that referenced this issue Sep 13, 2020
Adds set_max_idle_connections and set_max_idle_connections_per_host.

This turns the values of Pool.recycle into a VecDeque of Streams for the same PoolKey.
The freshest stream (most recently used) is at the back; the stalest stream is at the front.

This also removes the invariant "Each PoolKey exists in recycle at most once and lru at
most once," replacing it with "each PoolKey has the same number of entries in lru as in
recycle."

Fixes #110
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 a pull request may close this issue.

2 participants