fix: prefer ipv4 addresses in network::client::tcp::TcpStream
Summary
- fix: prefer ipv4 addresses in network::client::tcp::TcpStream
The reason for this change was discovered during work on the example in !377 (merged). When connecting to something like example.org:80
the process appeared to be painstakingly slow (might take minutes). The reason was discovered to be that both Rust std and our address resolution provided IPv6 addresses first in a list. And TcpStream
therefore tried to connect to them first. While it seems that IPv6 is still mostly unsupported and so TcpStream
falls back to IPv4 after a while, the waiting causing these enormous delays.
Ensure that
-
New code is covered by testsI didn't come up with a proper test case, that would not depend on connecting to external domains (likeexample.org
) -
API is documented -
Changelog is up to date -
Version is bumped in the appropriate Cargo.toml
files
Edited by Егор Ивков