From 9c56bca3b719a7e44074225a99d9f97fd05466d3 Mon Sep 17 00:00:00 2001
From: Tilman Sauerbeck <tilman@code-monkey.de>
Date: Thu, 9 Jan 2020 11:02:21 +0100
Subject: [PATCH] common: Synchronize sector headers after a recording is
 finished.

This is necessary to be able to retrieve the recording without
restarting the device.
---
 src/common/logger.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/common/logger.rs b/src/common/logger.rs
index d958193..d83d239 100644
--- a/src/common/logger.rs
+++ b/src/common/logger.rs
@@ -421,7 +421,13 @@ impl<'a> Logger<'a> {
         self.storage.write(this_sector as usize * SECTOR_SIZE,
                            &self.write_buffer);
 
-        self.sectors_written + 1
+        self.sectors_written += 1;
+
+        for i in 0..self.sectors_written {
+            self.read_sector_header((self.first_sector + i) as usize);
+        }
+
+        self.sectors_written
     }
 
     fn sector_header_iter(&self) -> SectorHeaderIter {
-- 
2.30.2