diff --git a/src/gate.rs b/src/gate.rs index 326b1548bc706b792ebb664f897457241545fd4b..546c9291d2a9896ef8f57b5eae0084150cbf65cc 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();