common: Synchronize sector headers after a recording is finished.
authorTilman Sauerbeck <tilman@code-monkey.de>
Thu, 9 Jan 2020 10:02:21 +0000 (11:02 +0100)
committerTilman Sauerbeck <tilman@code-monkey.de>
Thu, 9 Jan 2020 14:19:36 +0000 (15:19 +0100)
This is necessary to be able to retrieve the recording without
restarting the device.

src/common/logger.rs

index d958193c281d97205b694bd333a5adee51998ec5..d83d2391bfe1a6261dc2bb312e2a6a288d26ba16 100644 (file)
@@ -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 {