Skip to content

fix: prefer ipv4 addresses in network::client::tcp::TcpStream

Егор Ивков requested to merge ipv4-first into master

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 tests I didn't come up with a proper test case, that would not depend on connecting to external domains (like example.org)
  • API is documented
  • Changelog is up to date
  • Version is bumped in the appropriate Cargo.toml files
Edited by Егор Ивков

Merge request reports