convert std::sync::mpsc to crossbeam_channel (#22264)

This commit is contained in:
Jeff Biseda
2022-01-11 02:44:46 -08:00
committed by GitHub
parent 3c44d405c7
commit 8b66625c95
81 changed files with 313 additions and 346 deletions

View File

@ -12,6 +12,7 @@ edition = "2021"
[dependencies]
bincode = "1.3.3"
clap = "2.33.1"
crossbeam-channel = "0.5"
log = "0.4.14"
nix = "0.23.1"
rand = "0.7.0"

View File

@ -1,6 +1,7 @@
//! The `net_utils` module assists with networking
#![allow(clippy::integer_arithmetic)]
use {
crossbeam_channel::unbounded,
log::*,
rand::{thread_rng, Rng},
socket2::{Domain, SockAddr, Socket, Type},
@ -8,7 +9,7 @@ use {
collections::{BTreeMap, HashSet},
io::{self, Read, Write},
net::{IpAddr, SocketAddr, TcpListener, TcpStream, ToSocketAddrs, UdpSocket},
sync::{mpsc::channel, Arc, RwLock},
sync::{Arc, RwLock},
time::{Duration, Instant},
},
url::Url,
@ -138,7 +139,7 @@ fn do_verify_reachable_ports(
// Wait for a connection to open on each TCP port
for (port, tcp_listener) in tcp_listeners {
let (sender, receiver) = channel();
let (sender, receiver) = unbounded();
let listening_addr = tcp_listener.local_addr().unwrap();
let thread_handle = std::thread::spawn(move || {
debug!("Waiting for incoming connection on tcp/{}", port);