Skip to content

Commit

Permalink
Adjust service proto timeout mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
joii2020 committed Jun 27, 2024
1 parent 2b690d4 commit d6849b2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions fuzz/fuzz_targets/fuzz_service_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::{
collections::HashMap,
sync::{atomic::AtomicBool, Arc},
};
use tokio::time::{self, Duration};
use tokio::time::{sleep, Duration};

use ckb_fuzz::BufManager;

Expand Down Expand Up @@ -87,6 +87,8 @@ impl ServiceProtoTest {
ProtocolId::default(),
);

self.service_protocol.init(&mut proto_ctx).await;

self.service_protocol
.connected(proto_ctx.as_mut(&session_ctx), "")
.await;
Expand Down Expand Up @@ -120,11 +122,10 @@ fuzz_target!(|data: &[u8]| {

let _r = rt.block_on(async move {
tokio::select! {
_ = t.run() => println!(""),
_ = time::sleep(Duration::from_millis(100)) => println!("Timeout or Poll::Pending"),

_ = t.run() => (),
_ = sleep(Duration::from_millis(500)) => {
// panic!("pass");
},
}
});

println!("---- mk0");
});

0 comments on commit d6849b2

Please sign in to comment.