Update polling dependency from "2.8" to "3"

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/479/head
Manos Pitsidianakis 2 months ago
parent 57b45a9c4a
commit 67b88d24fc
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

58
Cargo.lock generated

@ -140,7 +140,7 @@ dependencies = [
"futures-lite",
"log",
"parking",
"polling",
"polling 2.8.0",
"rustix 0.37.23",
"slab",
"socket2 0.4.9",
@ -664,23 +664,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
dependencies = [
"cc",
"libc",
"windows-sys 0.52.0",
]
[[package]]
@ -950,6 +939,12 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
[[package]]
name = "hermit-abi"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
[[package]]
name = "http"
version = "0.2.9"
@ -1089,7 +1084,7 @@ dependencies = [
"log",
"mime",
"once_cell",
"polling",
"polling 2.8.0",
"serde",
"serde_json",
"slab",
@ -1217,9 +1212,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
[[package]]
name = "linux-raw-sys"
version = "0.4.5"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "log"
@ -1338,7 +1333,7 @@ dependencies = [
"nix",
"nom",
"notify",
"polling",
"polling 3.7.2",
"regex",
"rusqlite",
"sealed_test",
@ -1659,6 +1654,21 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "polling"
version = "3.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b"
dependencies = [
"cfg-if",
"concurrent-queue",
"hermit-abi 0.4.0",
"pin-project-lite",
"rustix 0.38.34",
"tracing",
"windows-sys 0.52.0",
]
[[package]]
name = "powerfmt"
version = "0.2.0"
@ -1870,15 +1880,15 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.9"
version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bfe0f2582b4931a45d1fa608f8a8722e8b3c7ac54dd6d5f3b3212791fedef49"
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [
"bitflags 2.4.0",
"errno",
"libc",
"linux-raw-sys 0.4.5",
"windows-sys 0.48.0",
"linux-raw-sys 0.4.14",
"windows-sys 0.52.0",
]
[[package]]
@ -2252,7 +2262,7 @@ dependencies = [
"cfg-if",
"fastrand 2.0.0",
"redox_syscall 0.3.5",
"rustix 0.38.9",
"rustix 0.38.34",
"windows-sys 0.48.0",
]

@ -36,7 +36,7 @@ native-tls = { version = "0.2.3", default-features = false, optional = true }
nix = { version = "0.29", default-features = false, features = ["fs", "socket", "dir", "hostname"] }
nom = { version = "7" }
notify = { version = "6.1.1", optional = true }
polling = { version = "2.8" }
polling = { version = "3" }
regex = { version = "1" }
rusqlite = { version = "^0.29", default-features = false, features = ["array"], optional = true }
serde = { version = "1.0", features = ["rc"] }

@ -59,6 +59,7 @@ pub fn connect<A: ToSocketAddrs>(addr: A, timeout: Option<Duration>) -> Result<T
}
Err(happy
.error
.take()
.unwrap_or_else(|| Error::new(ErrorKind::InvalidInput, "could not resolve to any address")))
}
@ -140,7 +141,12 @@ impl HappyEyeballs {
},
Err(e) if e.raw_os_error() == Some(libc::EINPROGRESS) => {
let interest = Event::writable(self.attempts.len());
match self.poller.add(&sock, interest) {
// SAFETY; `sock` is added to `self.attempts` and is deleted in `poll_once` or
// when `Self` is dropped.
// `polling` crate says:
//
// > The source must be delete()d from this Poller before it is dropped.
match unsafe { self.poller.add(&sock, interest) } {
Ok(()) => {
self.attempts.push(Some((saddr, sock)));
self.attempts_in_progress += 1;
@ -155,9 +161,9 @@ impl HappyEyeballs {
}
fn poll_once(&mut self, timeout: Option<Duration>) -> Result<Option<TcpStream>> {
let mut events = Vec::new();
let mut events = polling::Events::new();
self.poller.wait(&mut events, timeout)?;
for evt in &events {
for evt in events.iter() {
assert!(evt.writable);
let (sock_addr, sock) = self.attempts[evt.key].take().expect("attempt exists");
self.attempts_in_progress -= 1;
@ -195,6 +201,15 @@ impl HappyEyeballs {
}
}
impl Drop for HappyEyeballs {
fn drop(&mut self) {
for (_, socket) in self.attempts.drain(..).flatten() {
// The source must be delete()d from the Poller before it is dropped.
_ = self.poller.delete(&socket);
}
}
}
enum AddOutcome {
Connected(TcpStream),
InProgress,

Loading…
Cancel
Save