From dd86facc33e7b52d48e3671b4a98167a106b455d Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sun, 29 Dec 2019 07:13:47 +0100 Subject: [PATCH] store session: do send end() packet after data export to output file Extend the StoreSession::store_proc() method to send a SR_DF_END packet after all analog/logic data packets were sent and before the output file and output module get shutdown. This fixes bug #1470. --- pv/storesession.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pv/storesession.cpp b/pv/storesession.cpp index 42b13c46..f024a36c 100644 --- a/pv/storesession.cpp +++ b/pv/storesession.cpp @@ -251,6 +251,7 @@ void StoreSession::store_proc(vector< shared_ptr > achannel_li const unsigned int samples_per_block = min(asamples_per_block, lsamples_per_block); + const auto context = session_.device_manager().context(); while (!interrupt_ && sample_count_) { progress_updated(); @@ -258,8 +259,6 @@ void StoreSession::store_proc(vector< shared_ptr > achannel_li min((uint64_t)samples_per_block, sample_count_); try { - const auto context = session_.device_manager().context(); - for (unsigned int i = 0; i < achannel_list.size(); i++) { shared_ptr achannel = (achannel_list.at(i))->channel(); shared_ptr asegment = asegment_list.at(i); @@ -303,6 +302,11 @@ void StoreSession::store_proc(vector< shared_ptr > achannel_li units_stored_ = unit_count_ - (sample_count_ >> progress_scale); } + auto dfend = context->create_end_packet(); + const string ldata_str = output_->receive(dfend); + if (output_stream_.is_open()) + output_stream_ << ldata_str; + // Zeroing the progress variables indicates completion units_stored_ = unit_count_ = 0; -- 2.30.2