Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update socket2 requirement from 0.3.19 to 0.4.0 #1997

Merged
merged 2 commits into from
Mar 15, 2021
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: 1 addition & 1 deletion protocols/mdns/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ libp2p-swarm = { version = "0.28.0", path = "../../swarm" }
log = "0.4.14"
rand = "0.8.3"
smallvec = "1.6.1"
socket2 = { version = "0.3.19", features = ["reuseport"] }
socket2 = { version = "0.4.0", features = ["all"] }
void = "1.0.2"

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions protocols/mdns/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ impl Mdns {
pub async fn new(config: MdnsConfig) -> io::Result<Self> {
let recv_socket = {
let socket = Socket::new(
Domain::ipv4(),
Type::dgram(),
Some(socket2::Protocol::udp()),
Domain::IPV4,
Type::DGRAM,
Some(socket2::Protocol::UDP),
)?;
socket.set_reuse_address(true)?;
#[cfg(unix)]
socket.set_reuse_port(true)?;
socket.bind(&SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), 5353).into())?;
let socket = socket.into_udp_socket();
let socket = UdpSocket::from(socket);
socket.set_multicast_loop_v4(true)?;
socket.set_multicast_ttl_v4(255)?;
Async::new(socket)?
Expand Down
2 changes: 1 addition & 1 deletion transports/tcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ipnet = "2.0.0"
libc = "0.2.80"
libp2p-core = { version = "0.27.0", path = "../../core" }
log = "0.4.11"
socket2 = { version = "0.3.17", features = ["reuseport"] }
socket2 = { version = "0.4.0", features = ["all"] }
tokio-crate = { package = "tokio", version = "1.0.1", default-features = false, features = ["net"], optional = true }

[features]
Expand Down
10 changes: 5 additions & 5 deletions transports/tcp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ where

fn create_socket(&self, socket_addr: &SocketAddr) -> io::Result<Socket> {
let domain = if socket_addr.is_ipv4() {
Domain::ipv4()
Domain::IPV4
} else {
Domain::ipv6()
Domain::IPV6
};
let socket = Socket::new(domain, Type::stream(), Some(socket2::Protocol::tcp()))?;
let socket = Socket::new(domain, Type::STREAM, Some(socket2::Protocol::TCP))?;
if socket_addr.is_ipv6() {
socket.set_only_v6(true)?;
}
Expand All @@ -340,7 +340,7 @@ where
socket.bind(&socket_addr.into())?;
socket.listen(self.backlog as _)?;
socket.set_nonblocking(true)?;
TcpListenStream::<T>::new(socket.into_tcp_listener(), self.port_reuse)
TcpListenStream::<T>::new(socket.into(), self.port_reuse)
}

async fn do_dial(self, socket_addr: SocketAddr) -> Result<T::Stream, io::Error> {
Expand All @@ -360,7 +360,7 @@ where
Err(err) => return Err(err),
};

let stream = T::new_stream(socket.into_tcp_stream()).await?;
let stream = T::new_stream(socket.into()).await?;
Ok(stream)
}
}
Expand Down