uint16_t port;
Ip::Address addr;
- struct addrinfo *xai = NULL;
- int x;
-
if ((port = Config.Port.icp) <= 0)
return;
debugs(12, 1, "Outgoing ICP messages on port " << addr.GetPort() << ", FD " << theOutIcpConnection << ".");
fd_note(theOutIcpConnection, "Outgoing ICP socket");
+ icpGetOutgoingIpAddress();
}
+}
+static void
+icpGetOutgoingIpAddress()
+{
+ struct addrinfo *xai = NULL;
theOutICPAddr.SetEmpty();
-
theOutICPAddr.InitAddrInfo(xai);
- x = getsockname(theOutIcpConnection, xai->ai_addr, &xai->ai_addrlen);
-
- if (x < 0)
+ if (getsockname(theOutIcpConnection, xai->ai_addr, &xai->ai_addrlen) < 0)
debugs(50, 1, "theOutIcpConnection FD " << theOutIcpConnection << ": getsockname: " << xstrerror());
else
theOutICPAddr = *xai;
fd_note(theInIcpConnection, "Incoming ICP socket");
- if (Config.Addrs.udp_outgoing.IsNoAddr())
+ if (Config.Addrs.udp_outgoing.IsNoAddr()) {
theOutIcpConnection = theInIcpConnection;
+ icpGetOutgoingIpAddress();
+ }
}
/**