Skip to content

Commit

Permalink
refactor: remove need for clone
Browse files Browse the repository at this point in the history
  • Loading branch information
Devdutt Shenoi committed Mar 27, 2024
1 parent e42b296 commit aa46feb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions uplink/src/collector/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ impl FileDownloader {
}
}

state.current.meta.verify_checksum()?;
info!("Firmware downloaded successfully");

let mut action = state.current.action;
action.payload = serde_json::to_string(&state.current.meta)?;
let status = ActionResponse::done(&self.action_id, "Downloaded", Some(action))
.set_sequence(self.sequence());
self.bridge_tx.send_action_response(status).await;

Ok(())
}

Expand Down Expand Up @@ -262,15 +271,6 @@ impl FileDownloader {
}
}

state.current.meta.verify_checksum()?;
info!("Firmware downloaded successfully");

let mut action = state.current.action.clone();
action.payload = serde_json::to_string(&state.current.meta)?;
let status = ActionResponse::done(&self.action_id, "Downloaded", Some(action))
.set_sequence(self.sequence());
self.bridge_tx.send_action_response(status).await;

Ok(())
}

Expand Down

0 comments on commit aa46feb

Please sign in to comment.