summaryrefslogtreecommitdiff
path: root/lib/gras_impl/input_buffer_queues.hpp
diff options
context:
space:
mode:
authorJosh Blum2013-04-16 22:19:42 -0700
committerJosh Blum2013-04-16 22:19:42 -0700
commita832d3ba9ecd417be473257d47401f0719c1b23b (patch)
treed89aeef593a73835a14c351e59800ee25a3b8aed /lib/gras_impl/input_buffer_queues.hpp
parent92354bdf21ca30fabbfc6e02133581f627827296 (diff)
downloadsandhi-a832d3ba9ecd417be473257d47401f0719c1b23b.tar.gz
sandhi-a832d3ba9ecd417be473257d47401f0719c1b23b.tar.bz2
sandhi-a832d3ba9ecd417be473257d47401f0719c1b23b.zip
gras: enable half consumed metric on pool buffers
Diffstat (limited to 'lib/gras_impl/input_buffer_queues.hpp')
-rw-r--r--lib/gras_impl/input_buffer_queues.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp
index 7bdbddc..e45bc06 100644
--- a/lib/gras_impl/input_buffer_queues.hpp
+++ b/lib/gras_impl/input_buffer_queues.hpp
@@ -282,6 +282,7 @@ GRAS_FORCE_INLINE void InputBufferQueues::push(const size_t i, const SBuffer &bu
__update(i);
#ifdef GRAS_ENABLE_BUFFER_STITCHING
+ if (_queues[i].size() <= 1) return;
//stitch:
for (size_t j = _queues[i].size()-1; j > 0; j--)
{
@@ -298,6 +299,15 @@ GRAS_FORCE_INLINE void InputBufferQueues::push(const size_t i, const SBuffer &bu
b1.last = b0.get(b0.length);
}
}
+
+ //back got fully stitched and it was the same buffer -> pop it
+ SBuffer &b1 = _queues[i].back();
+ SBuffer &b0 = _queues[i][_queues[i].size()-2];
+ if (b1 == b0 and b1.length == 0)
+ {
+ b1.reset();
+ _queues[i].pop_back();
+ }
#endif //GRAS_ENABLE_BUFFER_STITCHING
}