]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Port from 2.7: Show local address on listening sockets
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Jun 2009 02:52:28 +0000 (14:52 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Jun 2009 02:52:28 +0000 (14:52 +1200)
src/fde.cc

index d1b32a13a4e977ae92d4514ab37dbcb566b5d79b..b66542cf41bf66586b48f1185608cf11dba6c75d 100644 (file)
@@ -107,12 +107,15 @@ fde::DumpStats (StoreEntry *dumpEntry)
 char const *
 fde::remoteAddr() const
 {
-    LOCAL_ARRAY(char, buf, 32);
+    LOCAL_ARRAY(char, buf, MAX_IPSTRLEN );
 
     if (type != FD_SOCKET)
         return null_string;
 
-    snprintf(buf, 32, "%s.%d", ipaddr, (int) remote_port);
+    if ( *ipaddr )
+        snprintf( buf, MAX_IPSTRLEN, "%s:%d", ipaddr, (int)remote_port);
+    else
+        local_addr.ToURL(buf,MAX_IPSTRLEN); // ToHostname does not include port.
 
     return buf;
 }