core: Force SegmentPublisher to publish at least one Data packet, which could have empty content
Change-Id: I8338f78ebfa4c2641eaae606b28c1112f06619c9
Refs: #1662
diff --git a/core/segment-publisher.hpp b/core/segment-publisher.hpp
index 287b5ac..b1aa4a9 100644
--- a/core/segment-publisher.hpp
+++ b/core/segment-publisher.hpp
@@ -71,7 +71,7 @@
const uint8_t* end = rawBuffer + buffer.size();
uint64_t segmentNo = 0;
- while (segmentBegin < end)
+ do
{
const uint8_t* segmentEnd = segmentBegin + getMaxSegmentSize();
if (segmentEnd > end)
@@ -94,6 +94,7 @@
publishSegment(data);
segmentNo++;
}
+ while (segmentBegin < end);
}
protected:
diff --git a/tests/core/segment-publisher.cpp b/tests/core/segment-publisher.cpp
index 627a7f0..da35376 100644
--- a/tests/core/segment-publisher.cpp
+++ b/tests/core/segment-publisher.cpp
@@ -141,7 +141,7 @@
};
using boost::mpl::int_;
-typedef boost::mpl::vector<int_<10000>, int_<100>, int_<10>/*, int_<0>*/ > DatasetSizes;
+typedef boost::mpl::vector<int_<10000>, int_<100>, int_<10>, int_<0> > DatasetSizes;
BOOST_AUTO_TEST_SUITE(SegmentPublisher)