downgraded dependency bytes and integrated the tracker into a system, next step will be to use a system that runs in parallel
This commit is contained in:
parent
008d3af930
commit
a0f80fef96
4 changed files with 30 additions and 21 deletions
|
@ -75,15 +75,22 @@ impl Tracker {
|
|||
pub fn update(&mut self) -> vrpn::Result<()> {
|
||||
|
||||
|
||||
|
||||
let mut buf = BytesMut::new();
|
||||
|
||||
// Read the message header and padding
|
||||
buf.resize(24, 0);
|
||||
self.stream.read_exact(buf.as_mut())?;
|
||||
|
||||
|
||||
// Peek the size field, to compute the MessageSize.
|
||||
|
||||
// let buf = buf.freeze();
|
||||
|
||||
let total_len = peek_u32(&buf.clone().freeze())?.unwrap();
|
||||
// let total_len = peek_u32(&buf)?.unwrap();
|
||||
let size = MessageSize::from_length_field(total_len);
|
||||
|
||||
|
||||
// Read the body of the message
|
||||
let mut body_buf = BytesMut::new();
|
||||
|
@ -96,23 +103,25 @@ impl Tracker {
|
|||
|
||||
// Unbuffer the message.
|
||||
let unbuffered = SequencedGenericMessage::unbuffer_ref(&mut buf)?;
|
||||
eprintln!("{:?}", Message::from(unbuffered));
|
||||
|
||||
|
||||
// eprintln!("{:?}", Message::from(unbuffered));
|
||||
info!("{:?}", Message::from(unbuffered));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn setup_tracker(mut commands: Commands) {
|
||||
// commands.spawn(Tracker::from_info("127.0.0.1", 3883));
|
||||
commands.spawn(Tracker::from_info("127.0.0.1", 3883));
|
||||
}
|
||||
|
||||
// pub fn update_tracker(mut query:Query<&mut Tracker>)
|
||||
// {
|
||||
// for mut tracker in query.iter_mut() {
|
||||
pub fn update_tracker(mut query:Query<&mut Tracker>)
|
||||
{
|
||||
for mut tracker in query.iter_mut() {
|
||||
|
||||
// // tracker.update();
|
||||
tracker.update();
|
||||
|
||||
// // tracker.connection.poll_endpoints();
|
||||
// // tracker
|
||||
// }
|
||||
// }
|
||||
// tracker.connection.poll_endpoints();
|
||||
// tracker
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue