Interleave sending and receiving of packets to reduce rx latency (#515)
* Interleave sending and receiving of packets to reduce latency in receiving of packets * Add patch to CtapUsbSyscallDriver * Minor tweaks from review * Log when overwritting an existing reply * Only log when 'debug_ctap' is enabled * Make ctap mod public, as per review * Rename send_or_recv to send_and_maybe_recv * fix typo * Don't process packets on other transport while doing keepalive * Don't process packets on other transport while doing keepalive * More accurately determine if reply has finished * Move comment closer to appropriate location * Add tests for canceling keepalive packets * Added a TODO for kaczmarczyck re ctap module being public * remove the unnecessary sleep()s * undo messed up commit * address pylint warnings * Fix merge mess up, and patch fido2 Usage Page * Fix up completely borked merge * Remove patch to FIDO usage, after #523. * remove obsolete aspects to diff Co-authored-by: kaczmarczyck <43844792+kaczmarczyck@users.noreply.github.com>
This commit is contained in:
@@ -32,6 +32,14 @@ impl HidPacketIterator {
|
||||
pub fn none() -> HidPacketIterator {
|
||||
HidPacketIterator(None)
|
||||
}
|
||||
|
||||
pub fn has_data(&self) -> bool {
|
||||
if let Some(ms) = &self.0 {
|
||||
ms.finished()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for HidPacketIterator {
|
||||
@@ -94,6 +102,15 @@ impl MessageSplitter {
|
||||
dst_len
|
||||
}
|
||||
}
|
||||
|
||||
// Is there more data to iterate over?
|
||||
fn finished(&self) -> bool {
|
||||
let payload_len = self.message.payload.len();
|
||||
match self.seq {
|
||||
None => true,
|
||||
Some(_) => self.i < payload_len,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Iterator for MessageSplitter {
|
||||
|
||||
Reference in New Issue
Block a user