-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
feat: parallelize IMAP and SMTP connection attempts #5915
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
link2xt
force-pushed
the
link2xt/parallel-connection-attempts
branch
from
August 25, 2024 07:52
07ac754
to
cdaefb4
Compare
link2xt
force-pushed
the
link2xt/parallel-connection-attempts
branch
4 times, most recently
from
August 26, 2024 13:48
31d6e54
to
260a697
Compare
link2xt
changed the title
feat: parallelize connection attempts
feat: parallelize IMAP and SMTP connection attempts
Aug 26, 2024
link2xt
force-pushed
the
link2xt/parallel-connection-attempts
branch
from
August 26, 2024 19:25
ecb5dd5
to
28659d1
Compare
This was referenced Aug 26, 2024
link2xt
force-pushed
the
link2xt/parallel-connection-attempts
branch
from
August 27, 2024 19:56
28659d1
to
e7fbeb7
Compare
link2xt
force-pushed
the
link2xt/parallel-connection-attempts
branch
from
August 28, 2024 00:07
ea8c1ed
to
42dc962
Compare
Hocuri
approved these changes
Aug 28, 2024
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.
LGTM now 🎉!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously for each connection candidate (essentially host and port pair) after resolving the host to a list of IPs Delta Chat iterated IP addresses one by one. Now for IMAP and SMTP we try up to 5 IP addresses in parallel. We start with one connection and add more connections later. If some connection fails, e.g. we try to connect to IPv6 on IPv4 network and get "Network is unreachable" (ENETUNREACH) error, we replace failed connection with another one immediately.
IPv6 addresses do not get any special priority. IP address prioritization happens in
lookup_host_with_cache
and currently addresses that are known to work recently are returned first.For HTTP there is a follow-up PR #5921 that replaces
reqwest
andhyper-util
connection code with custom connection establishment and direct usage ofhyper
client. Currentlyhyper-util
implements https://datatracker.ietf.org/doc/html/rfc6555 and tries at most two connection at a time: one IPv6 and one IPv4, with IPv4 attempts delayed by 300 ms on dual-stack hosts if both IPv6 and IPv4 addresses are returned.Closes #5799