changeset 58:9aa623e094b0

iothread: use the same session number for all frames Accidentally, we were using a different session number for each frame. The whole idea was that we would be able to tell log file discontinuity by a change in the session number. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Mon, 20 Jan 2020 09:34:08 -0500
parents a259f88f6a11
children f00ab2e1d9d7
files iothread.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/iothread.c	Fri Jan 17 10:34:30 2020 -0500
+++ b/iothread.c	Mon Jan 20 09:34:08 2020 -0500
@@ -80,6 +80,7 @@
 static int log_raw_ubx(struct ubx_header *_hdr, uint8_t *raw,
 		       uint64_t start_tick)
 {
+	static uint32_t session;
 	struct ubx_header hdr = *_hdr;
 	struct frame frame;
 	int ret;
@@ -88,8 +89,11 @@
 	if (!log_file)
 		return 0;
 
+	if (!session)
+		session = rand32();
+
 	frame.magic   = cpu32_to_be(FRAME_MAGIC);
-	frame.session = cpu32_to_be(rand32());
+	frame.session = cpu32_to_be(session);
 	frame.tick    = cpu64_to_be(start_tick);
 	frame.len     = cpu32_to_be(sizeof(hdr) + _hdr->len + 2);
 	frame._pad    = 0;