From 3d031c35eea4875d614f8610da92614589b4aeb4 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sun, 18 Jul 2010 20:21:22 +1200 Subject: [PATCH] Make comm_local_port record local IP in fde table if unknown --- src/comm.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/comm.cc b/src/comm.cc index f3fde6ab78..12f0fbc7ba 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -521,16 +521,12 @@ comm_local_port(int fd) temp.FreeAddrInfo(addr); - F->local_addr.SetPort(temp.GetPort()); - -#if 0 // seems to undo comm_open actions on the FD ... - // grab default socket information for this address - temp.GetAddrInfo(addr); - - F->sock_family = addr->ai_family; - - temp.FreeAddrInfo(addr); -#endif + if (F->local_addr.IsAnyAddr()) { + /* save the whole local address, not just the port. */ + F->local_addr = temp; + } else { + F->local_addr.SetPort(temp.GetPort()); + } debugs(5, 6, "comm_local_port: FD " << fd << ": port " << F->local_addr.GetPort() << "(family=" << F->sock_family << ")"); return F->local_addr.GetPort(); -- 2.47.2