From 2e5d6db0c73748f11fd7d5d524ef564e4ac8f7bb Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc Date: Tue, 22 Jan 2019 10:17:18 -0600 Subject: [PATCH] Forgot another small thing. I'm a dummy. --- utils/messageqcpp/bytestream.h | 12 +++++++++++- utils/messageqcpp/bytestreampool.cpp | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/utils/messageqcpp/bytestream.h b/utils/messageqcpp/bytestream.h index f8453843e..3750a3e61 100644 --- a/utils/messageqcpp/bytestream.h +++ b/utils/messageqcpp/bytestream.h @@ -381,6 +381,11 @@ public: */ inline void rewind(); + /** + * Get the allocated size of the buffer. + */ + inline uint32_t getBufferSize() const; + /** * Serializeable interface */ @@ -390,7 +395,7 @@ public: * Serializeable interface */ EXPORT void deserialize(ByteStream& bs); - + /** * memory allocation chunk size */ @@ -529,6 +534,11 @@ inline ByteStream& ByteStream::operator=(const SBS& rhs) return *this; } +inline uint32_t ByteStream::getBufferSize() const +{ + return fMaxLen; +} + /** * stream a ByteStream out to any ostream */ diff --git a/utils/messageqcpp/bytestreampool.cpp b/utils/messageqcpp/bytestreampool.cpp index 833cdb3e8..765ac449a 100644 --- a/utils/messageqcpp/bytestreampool.cpp +++ b/utils/messageqcpp/bytestreampool.cpp @@ -73,8 +73,10 @@ void ByteStreamPool::returnByteStream(ByteStream *bs) boost::mutex::scoped_lock s(mutex); if (freeByteStream.size() > maxFreeBuffers) delete bs; - else + else { + bs->restart(); freeByteStreams.push_back(bs); + } } }