aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-03-07 19:36:08 +0000
committerlloyd <[email protected]>2011-03-07 19:36:08 +0000
commitc5aa9dcd36eb55a0d6b07966c6f7e92ce5d7cbe5 (patch)
tree933c0cd425aeaee143b272c0af8cd73bcb54149f /src
parent5b3a23dfc1c407a44cb4dd10c546f2b8727cddcb (diff)
Split up deleting empty buffers with removing buffer slots from the
deque. This allows removing empty queues even if there are earlier messages with outstanding data; the buffer slot remains so some memory is still used, but reduced to just the pointer.
Diffstat (limited to 'src')
-rw-r--r--src/filters/out_buf.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/filters/out_buf.cpp b/src/filters/out_buf.cpp
index 7fa13b8e3..7b79b4b70 100644
--- a/src/filters/out_buf.cpp
+++ b/src/filters/out_buf.cpp
@@ -1,6 +1,6 @@
/*
* Pipe Output Buffer
-* (C) 1999-2007 Jack Lloyd
+* (C) 1999-2007,2011 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -65,16 +65,17 @@ void Output_Buffers::add(SecureQueue* queue)
*/
void Output_Buffers::retire()
{
- while(buffers.size())
- {
- if(buffers[0] == 0 || buffers[0]->size() == 0)
+ for(size_t i = 0; i != buffers.size(); ++i)
+ if(buffers[i] && buffers[i]->size() == 0)
{
- delete buffers[0];
- buffers.pop_front();
- offset = offset + Pipe::message_id(1);
+ delete buffers[i];
+ buffers[i] = 0;
}
- else
- break;
+
+ while(buffers.size() && !buffers[0])
+ {
+ buffers.pop_front();
+ offset = offset + Pipe::message_id(1);
}
}