feat(client): filter remote IP addresses by family of given local IP address

It is not possible to connect to an IPv4 address from an IPv6 address or
vice-versa so don't waste time trying. If no remote addresses match then a
"missing connect error" will now occur.
This commit is contained in:
James Le Cuirot
2019-11-13 14:56:53 +00:00
committed by Sean McArthur
parent 71d088d3d0
commit 131962c86a
2 changed files with 30 additions and 12 deletions

View File

@@ -501,7 +501,7 @@ impl ConnectingTcp {
reuse_address: bool,
) -> ConnectingTcp {
if let Some(fallback_timeout) = fallback_timeout {
let (preferred_addrs, fallback_addrs) = remote_addrs.split_by_preference();
let (preferred_addrs, fallback_addrs) = remote_addrs.split_by_preference(local_addr);
if fallback_addrs.is_empty() {
return ConnectingTcp {
local_addr,