Fix operation cancelation handling for poll driver

This commit is contained in:
Nikolay Kim 2025-03-14 23:39:47 +05:00
parent a83ed4c3fa
commit ff028c393b
3 changed files with 21 additions and 16 deletions

View file

@ -1,5 +1,9 @@
# Changes
## [2.5.3] - 2025-03-14
* Fix operation cancelation handling for poll driver
## [2.5.2] - 2025-03-14
* Fix operation cancelation handling for io-uring driver

View file

@ -1,6 +1,6 @@
[package]
name = "ntex-net"
version = "2.5.2"
version = "2.5.3"
authors = ["ntex contributors <team@ntex.rs>"]
description = "ntexwork utils for ntex framework"
keywords = ["network", "framework", "async", "futures"]

View file

@ -193,14 +193,17 @@ impl<T> Handler for StreamOpsHandler<T> {
let mut feed = self.inner.feed.take().unwrap();
for id in feed.drain(..) {
let item = &mut streams[id];
log::debug!("{}: Drop io ({}), {:?}", item.context.tag(), id, item.fd);
item.ref_count -= 1;
if item.ref_count == 0 {
let item = streams.remove(id);
if item.io.is_some() {
self.inner.api.unregister_all(item.fd);
}
log::debug!(
"{}: Drop io ({}), {:?}, has-io: {}",
item.context.tag(),
id,
item.fd,
item.io.is_some()
);
self.inner.api.unregister_all(item.fd);
}
}
@ -350,19 +353,17 @@ impl<T> Clone for StreamCtl<T> {
impl<T> Drop for StreamCtl<T> {
fn drop(&mut self) {
if let Some(mut streams) = self.inner.streams.take() {
log::debug!(
"{}: Drop io ({}), {:?}",
streams[self.id].context.tag(),
self.id,
streams[self.id].fd
);
streams[self.id].ref_count -= 1;
if streams[self.id].ref_count == 0 {
let item = streams.remove(self.id);
if item.io.is_some() {
self.inner.api.unregister_all(item.fd);
}
log::debug!(
"{}: Drop io ({}), {:?}, has-io: {}",
item.context.tag(),
self.id,
item.fd,
item.io.is_some()
);
self.inner.api.unregister_all(item.fd);
}
self.inner.streams.set(Some(streams));
} else {