Merge pull request 'bump spacepackets and cleanup a bit' (#17) from bump-spacepackets-cleanup into main
Reviewed-on: #17
This commit was merged in pull request #17.
This commit is contained in:
+3
-4
@@ -18,9 +18,8 @@ name = "cfdp"
|
||||
[dependencies]
|
||||
crc = "3"
|
||||
smallvec = "1"
|
||||
derive-new = ">=0.6, <=0.7"
|
||||
hashbrown = { version = ">=0.14, <=0.15", optional = true }
|
||||
spacepackets = { version = "0.17", default-features = false }
|
||||
hashbrown = { version = "0.17", optional = true }
|
||||
spacepackets = { version = "0.18", default-features = false }
|
||||
thiserror = { version = "2", default-features = false }
|
||||
heapless = "0.9"
|
||||
serde = { version = "1", optional = true }
|
||||
@@ -54,7 +53,7 @@ packet-buf-4k = []
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
rand = "0.9"
|
||||
rand = "0.10"
|
||||
log = "0.4"
|
||||
fern = "0.7"
|
||||
chrono = "0.4"
|
||||
|
||||
+6
-4
@@ -876,9 +876,9 @@ impl<
|
||||
);
|
||||
if let Err(e) = self.vfs.write_data(
|
||||
// Safety: It was already verified that the path is valid during the transaction start.
|
||||
#[allow(unsafe_code)]
|
||||
unsafe {
|
||||
from_utf8_unchecked(
|
||||
//from_utf8(
|
||||
&self.transaction_params.file_names.dest_path_buf
|
||||
[0..self.transaction_params.file_names.dest_file_path_len],
|
||||
)
|
||||
@@ -1469,6 +1469,7 @@ impl<
|
||||
match self.vfs.checksum_verify(
|
||||
checksum,
|
||||
// Safety: It was already verified that the path is valid during the transaction start.
|
||||
#[allow(unsafe_code)]
|
||||
unsafe {
|
||||
from_utf8_unchecked(
|
||||
&self.transaction_params.file_names.dest_path_buf
|
||||
@@ -1788,6 +1789,7 @@ impl<
|
||||
== DeliveryCode::Incomplete
|
||||
{
|
||||
// Safety: We already verified that the path is valid during the transaction start.
|
||||
#[allow(unsafe_code)]
|
||||
let dest_path = unsafe {
|
||||
from_utf8_unchecked(
|
||||
&self.transaction_params.file_names.dest_path_buf
|
||||
@@ -1914,7 +1916,7 @@ mod tests {
|
||||
};
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use rand::Rng;
|
||||
use rand::RngExt as _;
|
||||
use spacepackets::{
|
||||
cfdp::{
|
||||
ChecksumType, TransmissionMode,
|
||||
@@ -2305,7 +2307,7 @@ mod tests {
|
||||
|
||||
fn init_full_filepaths_textfile() -> (PathBuf, PathBuf) {
|
||||
(
|
||||
tempfile::TempPath::from_path("/tmp/test.txt").to_path_buf(),
|
||||
PathBuf::from("/tmp/test.txt"),
|
||||
tempfile::NamedTempFile::new()
|
||||
.unwrap()
|
||||
.into_temp_path()
|
||||
@@ -2976,7 +2978,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_file_copy_to_directory() {
|
||||
let fault_handler = TestFaultHandler::default();
|
||||
let src_path = tempfile::TempPath::from_path("/tmp/test.txt").to_path_buf();
|
||||
let src_path = PathBuf::from("/tmp/test.txt");
|
||||
let dest_path = tempfile::TempDir::new().unwrap();
|
||||
let mut dest_path_buf = dest_path.keep();
|
||||
let mut tb = DestHandlerTestbench::new(
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
//! you could schedule a fixed amount of handlers inside a
|
||||
//! [threadpool](https://docs.rs/threadpool/latest/threadpool/).
|
||||
#![no_std]
|
||||
#![warn(unsafe_code)]
|
||||
// Show which crate feature enables conditionally compiled APIs in documentation.
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
#[cfg(feature = "alloc")]
|
||||
|
||||
+12
-23
@@ -502,24 +502,16 @@ impl<
|
||||
}
|
||||
let remote_cfg = remote_cfg.unwrap();
|
||||
self.state_helper.num_packets_ready.set(0);
|
||||
let transmission_mode = if self.put_request_cacher.static_fields.trans_mode.is_some() {
|
||||
self.put_request_cacher.static_fields.trans_mode.unwrap()
|
||||
} else {
|
||||
remote_cfg.default_transmission_mode
|
||||
};
|
||||
let closure_requested = if self
|
||||
let transmission_mode = self
|
||||
.put_request_cacher
|
||||
.static_fields
|
||||
.trans_mode
|
||||
.unwrap_or(remote_cfg.default_transmission_mode);
|
||||
let closure_requested = self
|
||||
.put_request_cacher
|
||||
.static_fields
|
||||
.closure_requested
|
||||
.is_some()
|
||||
{
|
||||
self.put_request_cacher
|
||||
.static_fields
|
||||
.closure_requested
|
||||
.unwrap()
|
||||
} else {
|
||||
remote_cfg.closure_requested_by_default
|
||||
};
|
||||
.unwrap_or(remote_cfg.closure_requested_by_default);
|
||||
if self.put_request_cacher.has_source_file()
|
||||
&& !self.vfs.exists(self.put_request_cacher.source_file()?)?
|
||||
{
|
||||
@@ -529,7 +521,7 @@ impl<
|
||||
let transaction_id = TransactionId::new(
|
||||
self.local_cfg().id,
|
||||
UnsignedByteField::new(
|
||||
SequenceCounterInstance::MAX_BIT_WIDTH / 8,
|
||||
self.seq_count_provider.max_bit_width() / 8,
|
||||
self.seq_count_provider.get_and_increment().into(),
|
||||
),
|
||||
);
|
||||
@@ -1037,11 +1029,8 @@ impl<
|
||||
remote_cfg.max_packet_len,
|
||||
None,
|
||||
);
|
||||
if remote_cfg.max_file_segment_len.is_some() {
|
||||
derived_max_seg_len = core::cmp::min(
|
||||
remote_cfg.max_file_segment_len.unwrap(),
|
||||
derived_max_seg_len,
|
||||
);
|
||||
if let Some(max_file_segment_len) = remote_cfg.max_file_segment_len {
|
||||
derived_max_seg_len = core::cmp::min(max_file_segment_len, derived_max_seg_len);
|
||||
}
|
||||
derived_max_seg_len as u64
|
||||
}
|
||||
@@ -1292,7 +1281,7 @@ mod tests {
|
||||
use std::{fs::OpenOptions, io::Write, path::PathBuf, vec::Vec};
|
||||
|
||||
use alloc::string::String;
|
||||
use rand::Rng;
|
||||
use rand::RngExt as _;
|
||||
use spacepackets::{
|
||||
cfdp::{
|
||||
ChecksumType, CrcFlag,
|
||||
@@ -1325,7 +1314,7 @@ mod tests {
|
||||
fn init_full_filepaths_textfile() -> (TempPath, PathBuf) {
|
||||
(
|
||||
tempfile::NamedTempFile::new().unwrap().into_temp_path(),
|
||||
tempfile::TempPath::from_path("/tmp/test.txt").to_path_buf(),
|
||||
PathBuf::from("/tmp/test.txt"),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user