@@ -22,7 +22,7 @@ use libafl_bolts::{
2222 llmp:: { LLMP_FLAG_COMPRESSED , LLMP_FLAG_INITIALIZED } ,
2323} ;
2424
25- use super :: AwaitRestartSafe ;
25+ use super :: { AwaitRestartSafe , EventWithStats } ;
2626#[ cfg( feature = "llmp_compression" ) ]
2727use crate :: events:: llmp:: COMPRESS_THRESHOLD ;
2828use crate :: {
@@ -166,18 +166,18 @@ where
166166 }
167167
168168 #[ expect( clippy:: match_same_arms) ]
169- fn fire ( & mut self , state : & mut S , mut event : Event < I > ) -> Result < ( ) , Error > {
169+ fn fire ( & mut self , state : & mut S , mut event : EventWithStats < I > ) -> Result < ( ) , Error > {
170170 if !self . is_main {
171171 // secondary node
172172 let mut is_tc = false ;
173173 // Forward to main only if new tc, heartbeat, or optionally, a new objective
174- let should_be_forwarded = match & mut event {
174+ let should_be_forwarded = match event. event_mut ( ) {
175175 Event :: NewTestcase { forward_id, .. } => {
176176 * forward_id = Some ( ClientId ( self . inner . mgr_id ( ) . 0 as u32 ) ) ;
177177 is_tc = true ;
178178 true
179179 }
180- Event :: UpdateExecStats { .. } => true , // send UpdateExecStats but this guy won't be handled. the only purpose is to keep this client alive else the broker thinks it is dead and will dc it
180+ Event :: Heartbeat => true , // the only purpose is to keep this client alive else the broker thinks it is dead and will dc it
181181 Event :: Objective { .. } => true ,
182182 Event :: Stop => true ,
183183 _ => false ,
@@ -201,7 +201,10 @@ where
201201 state : & mut S ,
202202 severity_level : LogSeverity ,
203203 message : String ,
204- ) -> Result < ( ) , Error > {
204+ ) -> Result < ( ) , Error >
205+ where
206+ S : HasExecutions ,
207+ {
205208 self . inner . log ( state, severity_level, message)
206209 }
207210
@@ -261,7 +264,7 @@ where
261264 SHM : ShMem ,
262265 SP : ShMemProvider < ShMem = SHM > ,
263266{
264- fn try_receive ( & mut self , state : & mut S ) -> Result < Option < ( Event < I > , bool ) > , Error > {
267+ fn try_receive ( & mut self , state : & mut S ) -> Result < Option < ( EventWithStats < I > , bool ) > , Error > {
265268 if self . is_main {
266269 // main node
267270 self . receive_from_secondary ( state)
@@ -272,7 +275,7 @@ where
272275 }
273276 }
274277
275- fn on_interesting ( & mut self , state : & mut S , event : Event < I > ) -> Result < ( ) , Error > {
278+ fn on_interesting ( & mut self , state : & mut S , event : EventWithStats < I > ) -> Result < ( ) , Error > {
276279 self . inner . fire ( state, event)
277280 }
278281}
@@ -343,7 +346,7 @@ where
343346 SP : ShMemProvider < ShMem = SHM > ,
344347{
345348 #[ cfg( feature = "llmp_compression" ) ]
346- fn forward_to_main ( & mut self , event : & Event < I > ) -> Result < ( ) , Error > {
349+ fn forward_to_main ( & mut self , event : & EventWithStats < I > ) -> Result < ( ) , Error > {
347350 let serialized = postcard:: to_allocvec ( event) ?;
348351 let flags = LLMP_FLAG_INITIALIZED ;
349352
@@ -363,13 +366,16 @@ where
363366 }
364367
365368 #[ cfg( not( feature = "llmp_compression" ) ) ]
366- fn forward_to_main ( & mut self , event : & Event < I > ) -> Result < ( ) , Error > {
369+ fn forward_to_main ( & mut self , event : & EventWithStats < I > ) -> Result < ( ) , Error > {
367370 let serialized = postcard:: to_allocvec ( event) ?;
368371 self . client . send_buf ( _LLMP_TAG_TO_MAIN, & serialized) ?;
369372 Ok ( ( ) )
370373 }
371374
372- fn receive_from_secondary ( & mut self , state : & mut S ) -> Result < Option < ( Event < I > , bool ) > , Error > {
375+ fn receive_from_secondary (
376+ & mut self ,
377+ state : & mut S ,
378+ ) -> Result < Option < ( EventWithStats < I > , bool ) > , Error > {
373379 // TODO: Get around local event copy by moving handle_in_client
374380 let self_id = self . client . sender ( ) . id ( ) ;
375381 while let Some ( ( client_id, tag, _flags, msg) ) = self . client . recv_buf_with_flags ( ) ? {
@@ -392,15 +398,18 @@ where
392398 } else {
393399 msg
394400 } ;
395- let event: Event < I > = postcard:: from_bytes ( event_bytes) ?;
396- log:: debug!( "Processor received message {}" , event. name_detailed( ) ) ;
401+ let event: EventWithStats < I > = postcard:: from_bytes ( event_bytes) ?;
402+ log:: debug!(
403+ "Processor received message {}" ,
404+ event. event( ) . name_detailed( )
405+ ) ;
397406
398- let event_name = event. name_detailed ( ) ;
407+ let event_name = event. event ( ) . name_detailed ( ) ;
399408
400- match event {
409+ match event. event ( ) {
401410 Event :: NewTestcase {
402411 client_config,
403- ref observers_buf,
412+ observers_buf,
404413 forward_id,
405414 ..
406415 } => {
@@ -425,7 +434,7 @@ where
425434 _ => {
426435 return Err ( Error :: illegal_state ( format ! (
427436 "Received illegal message that message should not have arrived: {:?}." ,
428- event. name( )
437+ event. event ( ) . name( )
429438 ) ) ) ;
430439 }
431440 }
0 commit comments