Skip to content

Commit

Permalink
chore: upgrade net2 to tokio::net
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Apr 30, 2022
1 parent f38b35b commit 93c424c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
12 changes: 0 additions & 12 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion network_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ edition = "2021"
bytes = "1.1.0"
futures = "0.3.21"
async-trait = "0.1.53"
net2 = "0.2.37"
tokio = { version = "1.17.0", features = ["full"] }
tracing = { version = "0.1.34", features = ["log"] }
tokio-util = { version = "0.7.1", features = ["codec"] }

sui-types = { path = "../sui_types" }


[package.metadata.cargo-udeps.ignore]
normal = ["net2"]
8 changes: 4 additions & 4 deletions network_utils/src/unit_tests/transport_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use tokio::{runtime::Runtime, time::timeout};
use tracing::error;

async fn get_new_local_address() -> Result<String, std::io::Error> {
let builder = net2::TcpBuilder::new_v4()?;
builder.reuse_address(true)?;
builder.bind("127.0.0.1:0")?;
Ok(format!("{}", builder.local_addr()?))
let client = tokio::net::TcpSocket::new_v4()?;
client.set_reuseaddr(true)?;
client.bind("127.0.0.1:0".parse().unwrap())?;
Ok(format!("{}", client.local_addr()?))
}

struct TestService {
Expand Down

0 comments on commit 93c424c

Please sign in to comment.