Batch discard operations

This commit is contained in:
Christian Poveda 2023-12-04 10:34:44 -05:00 committed by Daniel McCarney
parent ab774c73cd
commit b1c0a29b6a
1 changed files with 15 additions and 4 deletions

View File

@ -20,10 +20,21 @@ fuzz_target!(|data: &[u8]| {
buf.has_pending();
let mut rl = RecordLayer::new();
let mut borrowed_buf = buf.borrow();
while let Ok(Some(decrypted)) = dfm.pop(&mut rl, None, &mut borrowed_buf) {
Message::try_from(decrypted.message).ok();
let mut discard = 0;
loop {
let mut borrowed_buf = buf.borrow();
borrowed_buf.queue_discard(discard);
let res = dfm.pop(&mut rl, None, &mut borrowed_buf);
discard = borrowed_buf.pending_discard();
if let Ok(Some(decrypted)) = res {
Message::try_from(decrypted.message).ok();
} else {
break;
}
}
let discard = borrowed_buf.pending_discard();
buf.discard(discard);
});