[domistream] WIP: rustfmt, doc link, clippy fixes (one collapsible-if left in rtsp/mod.rs), PROTOCOL.md status
Paused at Mark's request.
This commit is contained in:
@@ -367,14 +367,16 @@ impl EnetClient {
|
||||
check
|
||||
}
|
||||
CommandBody::SendUnreliable { unreliable_sequence, data } => {
|
||||
if self.state == EnetState::Connected && channel < self.channel_count {
|
||||
if let Some(ch) = self.channels.get_mut(usize::from(channel)) {
|
||||
let newer =
|
||||
ch.in_unreliable.is_none_or(|last| (1..0x8000).contains(&unreliable_sequence.wrapping_sub(last)));
|
||||
if newer {
|
||||
ch.in_unreliable = Some(unreliable_sequence);
|
||||
self.events.push_back(EnetEvent::Received { channel, data });
|
||||
}
|
||||
if self.state == EnetState::Connected
|
||||
&& channel < self.channel_count
|
||||
&& let Some(ch) = self.channels.get_mut(usize::from(channel))
|
||||
{
|
||||
let newer = ch
|
||||
.in_unreliable
|
||||
.is_none_or(|last| (1..0x8000).contains(&unreliable_sequence.wrapping_sub(last)));
|
||||
if newer {
|
||||
ch.in_unreliable = Some(unreliable_sequence);
|
||||
self.events.push_back(EnetEvent::Received { channel, data });
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -574,7 +576,10 @@ impl EnetClient {
|
||||
acknowledge: false,
|
||||
channel_id: channel,
|
||||
reliable_sequence: 0,
|
||||
body: CommandBody::SendUnsequenced { unsequenced_group: self.unsequenced_group, data: data.to_vec() },
|
||||
body: CommandBody::SendUnsequenced {
|
||||
unsequenced_group: self.unsequenced_group,
|
||||
data: data.to_vec(),
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -625,11 +630,9 @@ impl EnetClient {
|
||||
}
|
||||
size += protocol::command_size(c);
|
||||
if let Some(c) = self.resend.pop_front() {
|
||||
if let Some(f) = self
|
||||
.in_flight
|
||||
.iter_mut()
|
||||
.find(|f| f.command.channel_id == c.channel_id && f.command.reliable_sequence == c.reliable_sequence)
|
||||
{
|
||||
if let Some(f) = self.in_flight.iter_mut().find(|f| {
|
||||
f.command.channel_id == c.channel_id && f.command.reliable_sequence == c.reliable_sequence
|
||||
}) {
|
||||
f.sent_at = now;
|
||||
}
|
||||
commands.push(c);
|
||||
|
||||
Reference in New Issue
Block a user