Skip to content

Commit

Permalink
Merge pull request #1332 from akoshelev/send-buffer-another-attempt
Browse files Browse the repository at this point in the history
Fix send buffer misalignment [No 2]
  • Loading branch information
benjaminsavage authored Oct 7, 2024
2 parents b56e21c + 34838fe commit 57951b0
Show file tree
Hide file tree
Showing 22 changed files with 501 additions and 72 deletions.
1 change: 1 addition & 0 deletions ipa-core/benches/oneshot/ipa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl Args {
self.active_work
.map(NonZeroUsize::get)
.unwrap_or_else(|| self.query_size.clamp(16, 1024))
.next_power_of_two()
}

fn attribution_window(&self) -> Option<NonZeroU32> {
Expand Down
7 changes: 4 additions & 3 deletions ipa-core/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{num::NonZeroUsize, sync::Weak};
use std::sync::Weak;

use async_trait::async_trait;

Expand All @@ -13,17 +13,18 @@ use crate::{
protocol::QueryId,
query::{NewQueryError, QueryProcessor, QueryStatus},
sync::Arc,
utils::NonZeroU32PowerOfTwo,
};

#[derive(Default)]
pub struct AppConfig {
active_work: Option<NonZeroUsize>,
active_work: Option<NonZeroU32PowerOfTwo>,
key_registry: Option<KeyRegistry<PrivateKeyOnly>>,
}

impl AppConfig {
#[must_use]
pub fn with_active_work(mut self, active_work: Option<NonZeroUsize>) -> Self {
pub fn with_active_work(mut self, active_work: Option<NonZeroU32PowerOfTwo>) -> Self {
self.active_work = active_work;
self
}
Expand Down
5 changes: 2 additions & 3 deletions ipa-core/src/bin/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::{
fs,
io::BufReader,
net::TcpListener,
num::NonZeroUsize,
os::fd::{FromRawFd, RawFd},
path::{Path, PathBuf},
process,
Expand All @@ -18,7 +17,7 @@ use ipa_core::{
error::BoxError,
helpers::HelperIdentity,
net::{ClientIdentity, HttpShardTransport, HttpTransport, MpcHelperClient},
AppConfig, AppSetup,
AppConfig, AppSetup, NonZeroU32PowerOfTwo,
};
use tracing::{error, info};

Expand Down Expand Up @@ -93,7 +92,7 @@ struct ServerArgs {

/// Override the amount of active work processed in parallel
#[arg(long)]
active_work: Option<NonZeroUsize>,
active_work: Option<NonZeroU32PowerOfTwo>,
}

#[derive(Debug, Subcommand)]
Expand Down
Loading

0 comments on commit 57951b0

Please sign in to comment.