2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 77 Delay Pools */
14 #include "comm/Connection.h"
16 #include "DelayVector.h"
18 DelayVector::DelayVector()
20 DelayPools::registerForUpdates (this);
23 DelayVector::~DelayVector()
25 DelayPools::deregisterForUpdates (this);
29 DelayVector::stats(StoreEntry
* sentry
)
31 iterator pos
= pools
.begin();
33 while (pos
!= pools
.end()) {
34 (*pos
)->stats(sentry
);
40 DelayVector::dump(StoreEntry
*entry
) const
42 const_iterator pos
= pools
.begin();
44 while (pos
!= pools
.end()) {
51 DelayVector::update(int incr
)
54 * Each pool updates itself,
55 * but we may have deferred reads waiting on the pool as a whole.
64 iterator pos
= pools
.begin();
66 while (pos
!= pools
.end()) {
72 DelayIdComposite::Pointer
73 DelayVector::id(CompositeSelectionDetails
&details
)
75 return new Id(this, details
);
79 DelayVector::push_back(CompositePoolNode::Pointer aNode
)
81 pools
.push_back(aNode
);
84 DelayVector::Id::Id(DelayVector::Pointer aDelayVector
, CompositeSelectionDetails
&details
) : theVector(aDelayVector
)
86 debugs(77, 3, "DelayVector::Id::Id");
87 DelayVector::iterator pos
= theVector
->pools
.begin();
89 while (pos
!= theVector
->pools
.end()) {
90 ids
.push_back ((*pos
)->id (details
));
95 DelayVector::Id::~Id()
97 debugs(77, 3, "DelayVector::Id::~Id");
101 DelayVector::Id::bytesWanted (int minimum
, int maximum
) const
103 int nbytes
= maximum
;
104 const_iterator pos
= ids
.begin();
106 while (pos
!= ids
.end()) {
107 nbytes
= min (nbytes
, (*pos
)->bytesWanted(minimum
, nbytes
));
111 nbytes
= max(minimum
, nbytes
);
116 DelayVector::Id::bytesIn(int qty
)
118 iterator pos
= ids
.begin();
120 while (pos
!= ids
.end()) {
121 (*pos
)->bytesIn(qty
);
125 theVector
->kickReads();
129 DelayVector::Id::delayRead(DeferredRead
const &aRead
)
131 theVector
->delayRead(aRead
);