Skip to content

Commit

Permalink
NoNewGlobals for Comm::AcceptLimiter::Instance_ (#1954)
Browse files Browse the repository at this point in the history
Inspired by Coverity. CID 1441988: Useless call (USELESS_CALL).
  • Loading branch information
kinkie authored and squid-anubis committed Dec 1, 2024
1 parent c565067 commit 2e99fd8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/comm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,6 @@ comm_init(void)
{
assert(fd_table);

/* make sure the accept() socket FIFO delay queue exists */
Comm::AcceptLimiter::Instance();

// make sure the IO pending callback table exists
Comm::CallbackTableInit();

Expand Down
5 changes: 2 additions & 3 deletions src/comm/AcceptLimiter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
#include "fde.h"
#include "globals.h"

Comm::AcceptLimiter Comm::AcceptLimiter::Instance_;

Comm::AcceptLimiter &
Comm::AcceptLimiter::Instance()
{
return Instance_;
static const auto Instance_ = new AcceptLimiter();
return *Instance_;
}

void
Expand Down
2 changes: 0 additions & 2 deletions src/comm/AcceptLimiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class AcceptLimiter
void kick();

private:
static AcceptLimiter Instance_;

/** FIFO queue */
std::deque<TcpAcceptor::Pointer> deferred_;
};
Expand Down

0 comments on commit 2e99fd8

Please sign in to comment.