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 connection timeout to connect_with_connector_lazy #1619

Merged
merged 1 commit into from Feb 1, 2024

Conversation

Benjscho
Copy link
Contributor

@Benjscho Benjscho commented Feb 1, 2024

Currently connect_with_connector_lazy doesn't respect connection timeouts. This means that if you have a misbehaving or unresponsive server, a request that's connecting lazily with a custom connector can hang for the client without timing out. This commit adds the timeout to the custom connector if it has been set on the endpoint, bringing the behaviour in line with other connect methods.

Motivation

This brings the behaviour of connect_with_connector_lazy in line with the other connect methods that respect the connection time set on the Endpoint.

This solves instances where users set a connection time out on an endpoint, but use a custom connector to connect lazily. If the server fails to respond to the connection request at all then the connection attempt (and request) will hang without ever failing.

Solution

The solution is to use the same hyper_timeout connector to add a timeout.

Currently connect_with_connector_lazy doesn't respect connection
timeouts. This means that if you have a misbehaving server a request
that's connecting lazily can hang for the client without timing out.
This commit adds the timeout to the custom connector if it has been set
on the endpoint, bringing the behaviour in line with other connect
methods.
Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

Thanks!

@LucioFranco LucioFranco added this pull request to the merge queue Feb 1, 2024
Merged via the queue into hyperium:master with commit 4859a73 Feb 1, 2024
16 checks passed
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.

None yet

2 participants