From: Alex Rousskov Date: Mon, 29 Aug 2011 20:58:29 +0000 (-0600) Subject: Made FewToFewBiQueue::peek() check both incoming and outgoing queues X-Git-Tag: take08~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8c758062f8bf47a37f1d3b35c626e699eab5807;p=thirdparty%2Fsquid.git Made FewToFewBiQueue::peek() check both incoming and outgoing queues to find the oldest queued value. This may help when the delay is on our side (i.e., we are not receiving or processing completed I/Os fast enough). --- diff --git a/src/ipc/Queue.h b/src/ipc/Queue.h index 94a98f758e..c211031fec 100644 --- a/src/ipc/Queue.h +++ b/src/ipc/Queue.h @@ -328,9 +328,16 @@ FewToFewBiQueue::peek(const int remoteProcessId, Value &value) const if (!validProcessId(remoteGroup(), remoteProcessId)) return false; - const OneToOneUniQueue &remoteQueue = oneToOneQueue(theLocalGroup, theLocalProcessId, remoteGroup(), remoteProcessId); - debugs(54, 7, HERE << "peeking from " << theLocalProcessId << " to " << remoteProcessId << " at " << remoteQueue.size()); - return remoteQueue.peek(value); + // we need the oldest value, so start with the incoming, them-to-us queue: + const OneToOneUniQueue &inQueue = oneToOneQueue(remoteGroup(), remoteProcessId, theLocalGroup, theLocalProcessId); + debugs(54, 2, HERE << "peeking from " << remoteProcessId << " to " << theLocalProcessId << " at " << inQueue.size()); + if (inQueue.peek(value)) + return true; + + // if the incoming queue is empty, check the outgoing, us-to-them queue: + const OneToOneUniQueue &outQueue = oneToOneQueue(theLocalGroup, theLocalProcessId, remoteGroup(), remoteProcessId); + debugs(54, 2, HERE << "peeking from " << theLocalProcessId << " to " << remoteProcessId << " at " << outQueue.size()); + return outQueue.peek(value); } } // namespace Ipc