mirror of
https://github.com/jgoerzen/xbnet.git
synced 2025-01-03 12:08:21 -04:00
checkpointing
This commit is contained in:
parent
0bc7559915
commit
47ed503356
@ -98,9 +98,13 @@ fn main() {
|
||||
ping::genpings(dest_u64, xbeesender).expect("Failure in genpings")
|
||||
});
|
||||
ping::displaypongs(&mut xbreframer, &mut xb.ser_reader);
|
||||
// Make sure queued up data is sent
|
||||
let _ = writerthread.join();
|
||||
}
|
||||
Command::Pong => {
|
||||
ping::pong(&mut xbreframer, &mut xb.ser_reader, xbeesender).expect("Failure in pong");
|
||||
// Make sure queued up data is sent
|
||||
let _ = writerthread.join();
|
||||
}
|
||||
Command::Pipe { dest } => {
|
||||
let dest_u64: u64 = u64::from_str_radix(&dest, 16).expect("Invalid destination");
|
||||
@ -124,6 +128,8 @@ fn main() {
|
||||
});
|
||||
tap_reader.frames_from_tap_processor(maxpacketsize - 1, xbeesender)
|
||||
.expect("Failure in frames_from_tap_processor");
|
||||
// Make sure queued up data is sent
|
||||
let _ = writerthread.join();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
use bytes::*;
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
use std::fmt;
|
||||
use log::*;
|
||||
|
||||
/** XBee transmissions can give either a 64-bit or a 16-bit destination
|
||||
address. This permits the user to select one. */
|
||||
@ -191,12 +192,15 @@ impl PacketStream {
|
||||
return Ok(retval);
|
||||
}
|
||||
|
||||
trace!("xbpacket: data len {}", data.len());
|
||||
let chunks: Vec<&[u8]> = data.chunks(maxpacketsize - 1).collect();
|
||||
let mut chunks_remaining: u8 = u8::try_from(chunks.len() - 1)
|
||||
trace!("xbpacket: chunk count {}", chunks.len());
|
||||
let mut chunks_remaining: u8 = u8::try_from(chunks.len())
|
||||
.map_err(|e| String::from("More than 255 chunks to transmit"))?;
|
||||
for chunk in chunks {
|
||||
trace!("xbpacket: chunks_remaining: {}", chunks_remaining);
|
||||
let mut payload = BytesMut::new();
|
||||
payload.put_u8(chunks_remaining);
|
||||
payload.put_u8(chunks_remaining - 1);
|
||||
payload.put_slice(chunk);
|
||||
let frame_id = 0; // self.get_and_incr_framecounter(); // FIXME: make this configurable whether we get back TX reports.
|
||||
let packet = XBTXRequest {
|
||||
|
Loading…
Reference in New Issue
Block a user