]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/comm/AcceptLimiter.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / comm / AcceptLimiter.h
index 57313b142c1161af76df115a2495e663bfe803fa..95be974fb2534e34854dfba064994f4bcc612a93 100644 (file)
@@ -1,20 +1,29 @@
+/*
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #ifndef _SQUID_SRC_COMM_ACCEPT_LIMITER_H
 #define _SQUID_SRC_COMM_ACCEPT_LIMITER_H
 
-#include "Array.h"
+#include "comm/TcpAcceptor.h"
+
+#include <deque>
 
 namespace Comm
 {
 
-class ListenStateData;
-
 /**
  * FIFO Queue holding listener socket handlers which have been activated
  * ready to dupe their FD and accept() a new client connection.
  * But when doing so there were not enough FD available to handle the
  * new connection. These handlers are awaiting some FD to become free.
  *
- * defer - used only by Comm layer ListenStateData adding themselves when FD are limited.
+ * defer - used only by Comm layer ConnAcceptor adding themselves when FD are limited.
+ * removeDead - used only by Comm layer ConnAcceptor to remove themselves when dying.
  * kick - used by Comm layer when FD are closed.
  */
 class AcceptLimiter
@@ -25,7 +34,10 @@ public:
     static AcceptLimiter &Instance();
 
     /** delay accepting a new client connection. */
-    void defer(Comm::ListenStateData *afd);
+    void defer(const TcpAcceptor::Pointer &afd);
+
+    /** remove all records of an acceptor. Only to be called by the ConnAcceptor::swanSong() */
+    void removeDead(const TcpAcceptor::Pointer &afd);
 
     /** try to accept and begin processing any delayed client connections. */
     void kick();
@@ -34,9 +46,10 @@ private:
     static AcceptLimiter Instance_;
 
     /** FIFO queue */
-    Vector<Comm::ListenStateData*> deferred;
+    std::deque<TcpAcceptor::Pointer> deferred_;
 };
 
-}; // namepace Comm
+}; // namespace Comm
 
 #endif /* _SQUID_SRC_COMM_ACCEPT_LIMITER_H */
+