+/*
+ * 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 "comm/TcpAcceptor.h"
-#include <vector>
+#include <deque>
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
{
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 */
+