Ugly kludge to workaround kernel ipv6.disable=1

deepcrayon-v2.1
Jeff Moe 2023-11-08 09:42:32 -07:00
parent 652f59b7d9
commit 643635cd07
1 changed files with 0 additions and 18 deletions

View File

@ -448,23 +448,10 @@ SocketListenOp::SocketListenOp(std::uint16_t port, const SocketOptions& opts)
: port_{fmt::to_string(port)}, opts_{&opts} {}
std::unique_ptr<SocketImpl> SocketListenOp::run() {
if (opts_->prefer_ipv6()) {
C10D_DEBUG("The server socket will attempt to listen on an IPv6 address.");
if (tryListen(AF_INET6)) {
return std::move(socket_);
}
C10D_DEBUG("The server socket will attempt to listen on an IPv4 address.");
if (tryListen(AF_INET)) {
return std::move(socket_);
}
} else {
C10D_DEBUG(
"The server socket will attempt to listen on an IPv4 or IPv6 address.");
if (tryListen(AF_UNSPEC)) {
return std::move(socket_);
}
}
constexpr auto* msg =
"The server socket has failed to listen on any local network address.";
@ -688,10 +675,6 @@ std::unique_ptr<SocketImpl> SocketConnectOp::run() {
host_,
port_);
if (tryConnect(AF_INET6)) {
return std::move(socket_);
}
C10D_DEBUG(
"The client socket will attempt to connect to an IPv4 address of ({}, {}).",
host_,
@ -746,7 +729,6 @@ bool SocketConnectOp::tryConnect(int family) {
recordError(
"The {}network addresses of ({}, {}) cannot be retrieved (gai error: {} - {}).",
family == AF_INET ? "IPv4 "
: family == AF_INET6 ? "IPv6 "
: "",
host_,
port_,