emrekultursay updated this revision to Diff 263327. emrekultursay added a comment.
Update commit message. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79757/new/ https://reviews.llvm.org/D79757 Files: lldb/source/Host/common/TCPSocket.cpp Index: lldb/source/Host/common/TCPSocket.cpp =================================================================== --- lldb/source/Host/common/TCPSocket.cpp +++ lldb/source/Host/common/TCPSocket.cpp @@ -162,6 +162,12 @@ std::vector<SocketAddress> addresses = SocketAddress::GetAddressInfo( host_str.c_str(), nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP); + // IPv4 is more likely to succeed than IPv6. To avoid costly retries, + // we sort based on family to prioritize IPv4 over IPv6. + std::sort(addresses.begin(), addresses.end(), + [](SocketAddress a, SocketAddress b) { + return a.GetFamily() < b.GetFamily(); + }); for (SocketAddress &address : addresses) { error = CreateSocket(address.GetFamily()); if (error.Fail())
Index: lldb/source/Host/common/TCPSocket.cpp =================================================================== --- lldb/source/Host/common/TCPSocket.cpp +++ lldb/source/Host/common/TCPSocket.cpp @@ -162,6 +162,12 @@ std::vector<SocketAddress> addresses = SocketAddress::GetAddressInfo( host_str.c_str(), nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP); + // IPv4 is more likely to succeed than IPv6. To avoid costly retries, + // we sort based on family to prioritize IPv4 over IPv6. + std::sort(addresses.begin(), addresses.end(), + [](SocketAddress a, SocketAddress b) { + return a.GetFamily() < b.GetFamily(); + }); for (SocketAddress &address : addresses) { error = CreateSocket(address.GetFamily()); if (error.Fail())
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits