From 93195842f4eeaa79c14ea807810e354d272fe924 Mon Sep 17 00:00:00 2001 From: Stephen D <webmaster@scd31.com> Date: Fri, 17 Nov 2023 12:58:21 -0400 Subject: [PATCH] fix bug where NET was being added onto rf gated beacon packets --- src/gate.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gate.rs b/src/gate.rs index 326b154..546c929 100644 --- a/src/gate.rs +++ b/src/gate.rs @@ -57,17 +57,26 @@ pub fn beacon_forever( if let Some(c) = &c.beacon.comment { packet .add_comment(c) - .map_err(|e| anyhow!("Could not add gps to comment packet: {e}"))?; + .map_err(|e| anyhow!("Could not add gps to beacon packet: {e}"))?; } + let mut internet_packet = packet.clone(); + let mut rf_packet = packet; + + // internet route let mut r = Route::new(c.beacon.max_hops); - // TODO - we shouldn't be adding an internet route when gating to RF in this case r.push_internet().context("Could not create beacon route")?; - packet + internet_packet + .add_route(r) + .map_err(|e| anyhow!("Could not add route to beacon packet: {e}"))?; + + // rf route + let r = Route::new(c.beacon.max_hops); + rf_packet .add_route(r) - .map_err(|e| anyhow!("Could not add route to comment packet: {e}"))?; + .map_err(|e| anyhow!("Could not add route to beacon packet: {e}"))?; - let semi = packet + let semi = internet_packet .clone() .semi_encode() .map_err(|(e, _)| anyhow!("Could not encode beacon packet: {e}"))? @@ -77,7 +86,7 @@ pub fn beacon_forever( uuid: uuid.into(), }; - let full = packet + let full = rf_packet .fully_encode() .map_err(|e| anyhow!("Could not encode beacon packet: {e}"))? .to_vec(); -- GitLab