Skip to content

Commit ca26d44

Browse files
committed
Change the IP address in the connect_timeout_unroutable test.
Because the current address is reachable on some machines, which causes the test to fail. Fixes #44698, #50065.
1 parent b92552d commit ca26d44

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/libstd/net/tcp.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1675,9 +1675,13 @@ mod tests {
16751675

16761676
#[test]
16771677
fn connect_timeout_unroutable() {
1678-
// this IP is unroutable, so connections should always time out,
1679-
// provided the network is reachable to begin with.
1680-
let addr = "10.255.255.1:80".parse().unwrap();
1678+
// We want an IP address that is always unreachable and will trigger a
1679+
// timeout, regardless of whether a network connection is available or
1680+
// not. IPv4 doesn't have any address that is guaranteed to be
1681+
// unreachable, but 192.0.2.0 is part of the TEST-NET-1 address block,
1682+
// which is reserved for documentation and examples, and so is very
1683+
// likely to be unreachable.
1684+
let addr = "192.0.2.0:80".parse().unwrap();
16811685
let e = TcpStream::connect_timeout(&addr, Duration::from_millis(250)).unwrap_err();
16821686
assert!(e.kind() == io::ErrorKind::TimedOut ||
16831687
e.kind() == io::ErrorKind::Other,

0 commit comments

Comments
 (0)