* clippy

* doc

* refactor
This commit is contained in:
Dongjia Zhang 2022-03-21 15:54:46 +09:00 committed by GitHub
parent e36522cf21
commit c3d3c93bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -456,8 +456,8 @@ where
{ {
fn process(&mut self, fuzzer: &mut Z, state: &mut S, executor: &mut E) -> Result<usize, Error> { fn process(&mut self, fuzzer: &mut Z, state: &mut S, executor: &mut E) -> Result<usize, Error> {
// TODO: Get around local event copy by moving handle_in_client // TODO: Get around local event copy by moving handle_in_client
let mut events = vec![];
let self_id = self.llmp.sender.id; let self_id = self.llmp.sender.id;
let mut count = 0;
while let Some((client_id, tag, _flags, msg)) = self.llmp.recv_buf_with_flags()? { while let Some((client_id, tag, _flags, msg)) = self.llmp.recv_buf_with_flags()? {
assert!( assert!(
tag != _LLMP_TAG_EVENT_TO_BROKER, tag != _LLMP_TAG_EVENT_TO_BROKER,
@ -479,12 +479,9 @@ where
msg msg
}; };
let event: Event<I> = postcard::from_bytes(event_bytes)?; let event: Event<I> = postcard::from_bytes(event_bytes)?;
events.push((client_id, event)); self.handle_in_client(fuzzer, executor, state, client_id, event)?;
count += 1;
} }
let count = events.len();
events.drain(..).try_for_each(|(client_id, event)| {
self.handle_in_client(fuzzer, executor, state, client_id, event)
})?;
Ok(count) Ok(count)
} }
} }

View File

@ -41,7 +41,7 @@ crate::create_anymap_for_trait!(
pub use observers_anymap::{AnyMap as ObserversAnyMap, NamedAnyMap as NamedObserversAnyMap}; pub use observers_anymap::{AnyMap as ObserversAnyMap, NamedAnyMap as NamedObserversAnyMap};
/// An owned list of `Observer` trait objects /// An owned list of `Observer` trait objects
/// This is not really serializable, using this struct needs [`EventConfig::AlwaysUnique`] as configuration /// This is not really serializable, using this struct needs [`crate::events::EventConfig::AlwaysUnique`] as configuration
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct ObserversOwnedMap<I: 'static + Debug, S: 'static + Debug> { pub struct ObserversOwnedMap<I: 'static + Debug, S: 'static + Debug> {
/// The named trait objects map /// The named trait objects map