Skip to content

Commit

Permalink
Fix Comm::TcpAcceptor::status() reporting of listening address (#1891)
Browse files Browse the repository at this point in the history
Buggy "static" caching optimization led to TcpAcceptor X reporting
listening address of TcpAcceptor Y or an incorrect 0.0.0.0 address.
TcpAcceptor status is visible in mgr:jobs and level-5+ debugs() output.

Side effect: For a listening port configured without an explicit IP
address, the listening address part of status() is now reported using
"[::]" rather than "0.0.0.0" string.

Broken since 2011 commit cbff89b.
  • Loading branch information
rousskov authored and squid-anubis committed Aug 22, 2024
1 parent 46b1009 commit 64b6288
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/comm/TcpAcceptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ Comm::TcpAcceptor::status() const
if (conn == nullptr)
return "[nil connection]";

static char ipbuf[MAX_IPSTRLEN] = {'\0'};
if (ipbuf[0] == '\0')
conn->local.toHostStr(ipbuf, MAX_IPSTRLEN);
char ipbuf[MAX_IPSTRLEN];
conn->local.toHostStr(ipbuf, MAX_IPSTRLEN); // XXX: report port using toUrl()

static MemBuf buf;
buf.reset();
Expand Down

0 comments on commit 64b6288

Please sign in to comment.