| ... | @@ -573,7 +573,15 @@ pub fn tcpConnectToHost(allocator: *mem.Allocator, name: []const u8, port: u16) | ... | @@ -573,7 +573,15 @@ pub fn tcpConnectToHost(allocator: *mem.Allocator, name: []const u8, port: u16) |
| 573 | | 573 | |
| 574 | if (list.addrs.len == 0) return error.UnknownHostName; | 574 | if (list.addrs.len == 0) return error.UnknownHostName; |
| 575 | | 575 | |
| 576 | return tcpConnectToAddress(list.addrs[0]); | 576 | for (list.addrs) |addr| { |
| | 577 | return tcpConnectToAddress(addr) catch |err| switch (err) { |
| | 578 | error.ConnectionRefused => { |
| | 579 | continue; |
| | 580 | }, |
| | 581 | else => return err, |
| | 582 | }; |
| | 583 | } |
| | 584 | return std.os.ConnectError.ConnectionRefused; |
| 577 | } | 585 | } |
| 578 | | 586 | |
| 579 | pub fn tcpConnectToAddress(address: Address) !fs.File { | 587 | pub fn tcpConnectToAddress(address: Address) !fs.File { |