Skip to content
Merged
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
2 changes: 2 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions massa-bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ parking_lot = { version = "0.12", features = ["deadlock_detection"] }
tokio = { version = "1.23", features = ["full"] }
tracing = "0.1"
substruct = { git = "https://github.com/sydhds/substruct" }
socket2 = "0.4.7"

# custom modules
massa_async_pool = { path = "../massa-async-pool" }
Expand Down
12 changes: 11 additions & 1 deletion massa-bootstrap/src/establisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@ pub mod types {
/// # Argument
/// * `addr`: `SocketAddr` we want to bind to.
pub async fn get_listener(&mut self, addr: SocketAddr) -> io::Result<DefaultListener> {
Ok(DefaultListener(TcpListener::bind(addr).await?))
// Create a socket2 TCP listener to manually set the IPV6_V6ONLY flag
let socket = socket2::Socket::new(socket2::Domain::IPV6, socket2::Type::STREAM, None)?;

socket.set_only_v6(false)?;
socket.set_nonblocking(true)?;
socket.bind(&addr.into())?;

// Number of connections to queue, set to the hardcoded value used by tokio
socket.listen(1024)?;

Ok(DefaultListener(TcpListener::from_std(socket.into())?))
}

/// Get the connector with associated timeout
Expand Down
1 change: 1 addition & 0 deletions massa-bootstrap/src/tests/mock_establisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use massa_models::config::{CHANNEL_SIZE, MAX_DUPLEX_BUFFER_SIZE};
use massa_time::MassaTime;
use socket2 as _;
use std::io;
use std::net::SocketAddr;
use tokio::io::DuplexStream;
Expand Down
1 change: 1 addition & 0 deletions massa-network-exports/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0"
tokio = { version = "1.23", features = ["full"] }
enum-map = { version = "2.4", features = ["serde"] }
socket2 = "0.4.7"
# custom modules
massa_hash = { path = "../massa-hash" }
massa_models = { path = "../massa-models" }
Expand Down
12 changes: 11 additions & 1 deletion massa-network-exports/src/establisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,17 @@ mod types {
/// # Argument
/// * `addr`: `SocketAddr` we want to bind to.
pub async fn get_listener(&mut self, addr: SocketAddr) -> io::Result<DefaultListener> {
Ok(DefaultListener(TcpListener::bind(addr).await?))
// Create a socket2 TCP listener to manually set the IPV6_V6ONLY flag
let socket = socket2::Socket::new(socket2::Domain::IPV6, socket2::Type::STREAM, None)?;

socket.set_only_v6(false)?;
socket.set_nonblocking(true)?;
socket.bind(&addr.into())?;

// Number of connections to queue, set to the hardcoded value used by tokio
socket.listen(1024)?;

Ok(DefaultListener(TcpListener::from_std(socket.into())?))
}

/// Get the connector with associated timeout
Expand Down
1 change: 1 addition & 0 deletions massa-network-exports/src/test_exports/mock_establisher.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2022 MASSA LABS <[email protected]>

use massa_time::MassaTime;
use socket2 as _;
use std::io;
use std::net::SocketAddr;
use tokio::io::DuplexStream;
Expand Down