Skip to content

Commit

Permalink
use ipv4 if that's what the gossip server listens on
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn committed Aug 21, 2023
1 parent d136c00 commit 266ba13
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/corro-agent/src/api/peer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::cmp;
use std::collections::HashMap;
use std::net::SocketAddr;
use std::ops::RangeInclusive;
use std::sync::Arc;

Expand Down Expand Up @@ -273,7 +274,12 @@ async fn build_quinn_client_config(config: &GossipConfig) -> eyre::Result<quinn:

pub async fn gossip_client_endpoint(config: &GossipConfig) -> eyre::Result<quinn::Endpoint> {
let client_config = build_quinn_client_config(config).await?;
let mut client = quinn::Endpoint::client("[::]:0".parse()?)?;

let client_bind_addr = match config.bind_addr {
SocketAddr::V4(_) => "0.0.0.0:0".parse()?,
SocketAddr::V6(_) => "[::]:0".parse()?,
};
let mut client = quinn::Endpoint::client(client_bind_addr)?;

client.set_default_client_config(client_config);
Ok(client)
Expand Down

0 comments on commit 266ba13

Please sign in to comment.