Writer error reporting improvement
This commit is contained in:
+16
-4
@@ -14,8 +14,11 @@ StreamWriter::StreamWriter(ZMQContext &context, Logger &in_logger, const std::st
|
||||
|
||||
void StreamWriter::CollectImages(std::vector<HDF5DataFileStatistics> &v) {
|
||||
bool run = true;
|
||||
while (run && (image_puller.GetFrameType() != CBORStream2Deserializer::Type::START))
|
||||
run = image_puller.WaitForImage();
|
||||
while (run && (image_puller.GetFrameType() != CBORStream2Deserializer::Type::START)) {
|
||||
if (image_puller.GetFrameType() == CBORStream2Deserializer::Type::IMAGE)
|
||||
logger.Warning("Missing meaningful image while waiting for START");
|
||||
run = WaitForImage();
|
||||
}
|
||||
|
||||
if (!run)
|
||||
return;
|
||||
@@ -34,7 +37,7 @@ void StreamWriter::CollectImages(std::vector<HDF5DataFileStatistics> &v) {
|
||||
HDF5Writer writer(start_message);
|
||||
|
||||
bool first_image = true;
|
||||
run = image_puller.WaitForImage();
|
||||
run = WaitForImage();
|
||||
while (run && (image_puller.GetFrameType() == CBORStream2Deserializer::Type::IMAGE)) {
|
||||
if (first_image) {
|
||||
state = StreamWriterState::Receiving;
|
||||
@@ -51,7 +54,7 @@ void StreamWriter::CollectImages(std::vector<HDF5DataFileStatistics> &v) {
|
||||
|
||||
processed_images++;
|
||||
processed_image_size += image_array.image.size;
|
||||
run = image_puller.WaitForImage();
|
||||
run = WaitForImage();
|
||||
}
|
||||
|
||||
if (image_puller.GetFrameType() == CBORStream2Deserializer::Type::END) {
|
||||
@@ -90,6 +93,15 @@ StreamWriterOutput StreamWriter::Run() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool StreamWriter::WaitForImage() {
|
||||
try {
|
||||
return image_puller.WaitForImage();
|
||||
} catch (const JFJochException &e) {
|
||||
logger.ErrorException(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
StreamWriterStatistics StreamWriter::GetStatistics() const {
|
||||
float perf_MBs = 0.0f, perf_Hz = 0.0f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user