Skip to content

Commit

Permalink
allow disabling GSO for problematic setups
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn committed Aug 20, 2023
1 parent 357623e commit ad6b3a0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions crates/corro-agent/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,13 @@ pub async fn run(agent: Agent, opts: AgentOptions) -> eyre::Result<()> {
let tripwire = tripwire.clone();
tokio::spawn(async move {
let remote_addr = connecting.remote_address();
let local_ip = connecting.local_ip().unwrap();
// let local_ip = connecting.local_ip().unwrap();
debug!("got a connection from {remote_addr}");

let conn = match connecting.await {
Ok(conn) => conn,
Err(e) => {
error!("could not connection from {remote_addr} to {local_ip}: {e}");
error!("could not connection from {remote_addr}: {e}");
return;
}
};
Expand Down Expand Up @@ -793,7 +793,7 @@ pub async fn run(agent: Agent, opts: AgentOptions) -> eyre::Result<()> {
));

let gossip_chunker =
ReceiverStream::new(bcast_rx).chunks_timeout(512, Duration::from_millis(500));
ReceiverStream::new(bcast_rx).chunks_timeout(10, Duration::from_millis(500));
tokio::pin!(gossip_chunker);

loop {
Expand Down Expand Up @@ -1100,7 +1100,7 @@ async fn generate_bootstrap(
// fallback to in-db nodes
let conn = pool.read().await?;
addrs = block_in_place(|| {
let mut prepped = conn.prepare("select address from __corro_members limit 5")?;
let mut prepped = conn.prepare("SELECT address FROM __corro_members LIMIT 5")?;
let node_addrs = prepped.query_map([], |row| row.get::<_, String>(0))?;
Ok::<_, rusqlite::Error>(
node_addrs
Expand Down
5 changes: 5 additions & 0 deletions crates/corro-agent/src/api/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ fn build_quinn_transport_config(config: &GossipConfig) -> quinn::TransportConfig
transport_config.mtu_discovery_config(Some(mtu_discovery));
}

if config.disable_gso {
transport_config.enable_segmentation_offload(false);
}

transport_config
}

Expand Down Expand Up @@ -694,6 +698,7 @@ mod tests {
}),
plaintext: false,
max_mtu: None,
disable_gso: false,
};

let server = gossip_server_endpoint(&gossip_config).await?;
Expand Down
3 changes: 3 additions & 0 deletions crates/corro-types/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ pub struct GossipConfig {
pub plaintext: bool,
#[serde(default)]
pub max_mtu: Option<u16>,
#[serde(default)]
pub disable_gso: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -233,6 +235,7 @@ impl ConfigBuilder {
plaintext: self.tls.is_none(),
tls: self.tls,
max_mtu: None, // TODO: add a builder function for it
disable_gso: false,
},
admin: AdminConfig {
uds_path: self.admin_path.unwrap_or_else(default_admin_path),
Expand Down
1 change: 1 addition & 0 deletions examples/fly/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ addr = "fly-local-6pn:8787"
bootstrap = ["corrosion2.internal:8787"]
plaintext = true
max_mtu = 1372
disable_gso = true

[api]
addr = "[::]:8080"
Expand Down

0 comments on commit ad6b3a0

Please sign in to comment.