Skip to content

Commit

Permalink
fix Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Aug 9, 2024
1 parent 0799e37 commit 0529246
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions rust/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@ pub struct WorkerSettings {
/// "WebRTC-Bwe-AlrLimitedBackoff/Enabled/".
#[doc(hidden)]
pub libwebrtc_field_trials: Option<String>,
/// Disable liburing (io_uring) despite it's supported in current host.
pub disable_liburing: Option<bool>,
/// Enable liburing This option is ignored if io_uring is not supported by
/// current host.
///
/// Default `true`.
pub enable_liburing: bool,
/// Function that will be called under worker thread before worker starts, can be used for
/// pinning worker threads to CPU cores.
pub thread_initializer: Option<Arc<dyn Fn() + Send + Sync>>,
Expand Down Expand Up @@ -223,7 +226,7 @@ impl Default for WorkerSettings {
rtc_port_range: 10000..=59999,
dtls_files: None,
libwebrtc_field_trials: None,
disable_liburing: None,
enable_liburing: true,
thread_initializer: None,
app_data: AppData::default(),
}
Expand All @@ -238,7 +241,7 @@ impl fmt::Debug for WorkerSettings {
rtc_port_range,
dtls_files,
libwebrtc_field_trials,
disable_liburing,
enable_liburing,
thread_initializer,
app_data,
} = self;
Expand All @@ -249,7 +252,7 @@ impl fmt::Debug for WorkerSettings {
.field("rtc_port_range", &rtc_port_range)
.field("dtls_files", &dtls_files)
.field("libwebrtc_field_trials", &libwebrtc_field_trials)
.field("disable_liburing", &disable_liburing)
.field("enable_liburing", &enable_liburing)
.field(
"thread_initializer",
&thread_initializer.as_ref().map(|_| "ThreadInitializer"),
Expand Down Expand Up @@ -361,7 +364,7 @@ impl Inner {
rtc_port_range,
dtls_files,
libwebrtc_field_trials,
disable_liburing,
enable_liburing,
thread_initializer,
app_data,
}: WorkerSettings,
Expand Down Expand Up @@ -410,8 +413,8 @@ impl Inner {
));
}

if let Some(disable_liburing) = disable_liburing {
spawn_args.push(format!("--disable_liburing"));
if enable_liburing {
spawn_args.push("--disable_liburing".to_string());
}

let id = WorkerId::new();
Expand Down

0 comments on commit 0529246

Please sign in to comment.