Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ quic = ["dep:webpki", "dep:quinn", "dep:rustls", "dep:ring", "dep:rcgen"]
webrtc = ["dep:str0m"]
rsa = ["dep:ring"]

# Shadow simulation compatibility
x-shadow = []

[profile.release]
debug = true

Expand Down
1 change: 1 addition & 0 deletions src/transport/tcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ impl TcpTransport {
socket.set_nonblocking(true)?;
socket.set_nodelay(nodelay)?;

#[cfg(not(feature = "x-shadow"))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an existing runtime configuration for this in tcp::Config (and similarly for websocket):

pub reuse_port: bool,

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration only applies to listening sockets, and it is ok. But problem happens when we are trying to bind address for outgoing sockets.

match dial_addresses.local_dial_address(&remote_address.ip()) {
Ok(Some(dial_address)) => {
socket.set_reuse_address(true)?;
Expand Down
1 change: 1 addition & 0 deletions src/transport/websocket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ impl WebSocketTransport {
socket.set_nonblocking(true)?;
socket.set_nodelay(nodelay)?;

#[cfg(not(feature = "x-shadow"))]
match dial_addresses.local_dial_address(&remote_address.ip()) {
Ok(Some(dial_address)) => {
socket.set_reuse_address(true)?;
Expand Down