]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/comm/AcceptLimiter.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / comm / AcceptLimiter.h
index f0b9e9eca9438a7d082014bc4e78b6106a728025..95be974fb2534e34854dfba064994f4bcc612a93 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
+ * 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.
@@ -11,7 +11,7 @@
 
 #include "comm/TcpAcceptor.h"
 
-#include <vector>
+#include <deque>
 
 namespace Comm
 {
@@ -26,16 +26,6 @@ namespace Comm
  * removeDead - used only by Comm layer ConnAcceptor to remove themselves when dying.
  * kick - used by Comm layer when FD are closed.
  */
-/* TODO this algorithm can be optimized further:
- *
- * 1) reduce overheads by only pushing one entry per port to the list?
- * use TcpAcceptor::isLimited as a flag whether to re-list when kick()'ing
- * or to NULL an entry while scanning the list for empty spaces.
- * Side effect: TcpAcceptor->kick() becomes allowed to pull off multiple accept()'s in bunches
- *
- * 2) re-implement as a std::queue instead of std::vector
- * storing head/tail pointers for fast push/pop and avoiding the whole shift() overhead
- */
 class AcceptLimiter
 {
 
@@ -56,10 +46,10 @@ private:
     static AcceptLimiter Instance_;
 
     /** FIFO queue */
-    std::vector<TcpAcceptor::Pointer> deferred_;
+    std::deque<TcpAcceptor::Pointer> deferred_;
 };
 
-}; // namepace Comm
+}; // namespace Comm
 
 #endif /* _SQUID_SRC_COMM_ACCEPT_LIMITER_H */