added sleep time to loop
This commit is contained in:
parent
f9782b48d4
commit
43eba77a51
@ -1,5 +1,4 @@
|
|||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use std::{ffi::c_void, io::Read, io::Write, net::TcpListener};
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
corpus::Corpus, engines::State, executors::Executor, inputs::Input, utils::Rand, AflError,
|
corpus::Corpus, engines::State, executors::Executor, inputs::Input, utils::Rand, AflError,
|
||||||
|
@ -50,7 +50,7 @@ Then register some clientloops using llmp_broker_register_threaded_clientloop
|
|||||||
|
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::sync::atomic::{compiler_fence, Ordering};
|
use core::sync::atomic::{compiler_fence, Ordering};
|
||||||
use core::time;
|
use core::time::Duration;
|
||||||
use libc::{c_uint, c_ulong, c_ushort};
|
use libc::{c_uint, c_ulong, c_ushort};
|
||||||
use std::{cmp::max, ffi::CStr, mem::size_of, thread};
|
use std::{cmp::max, ffi::CStr, mem::size_of, thread};
|
||||||
|
|
||||||
@ -726,14 +726,16 @@ impl LlmpBroker {
|
|||||||
|
|
||||||
/// Loops infinitely, forwarding and handling all incoming messages from clients.
|
/// Loops infinitely, forwarding and handling all incoming messages from clients.
|
||||||
/// Never returns. Panics on error.
|
/// Never returns. Panics on error.
|
||||||
pub unsafe fn loop_forever(&mut self) -> ! {
|
/// 5 millis of sleep can't hurt to keep busywait not at 100%
|
||||||
|
pub unsafe fn loop_forever(&mut self, sleep_time: Option<Duration>) -> ! {
|
||||||
loop {
|
loop {
|
||||||
compiler_fence(Ordering::SeqCst);
|
compiler_fence(Ordering::SeqCst);
|
||||||
self.once()
|
self.once()
|
||||||
.expect("An error occurred when brokering. Exiting.");
|
.expect("An error occurred when brokering. Exiting.");
|
||||||
|
match sleep_time {
|
||||||
/* 5 milis of sleep for now to not busywait at 100% */
|
Some(time) => thread::sleep(time),
|
||||||
thread::sleep(time::Duration::from_millis(5));
|
None => (),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user