async: don't leak AsyncFdData
This commit is contained in:
parent
d52dc5f6e9
commit
c8068ee2e7
1 changed files with 1 additions and 6 deletions
|
|
@ -755,12 +755,6 @@ mod fd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for AsyncFdData {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
let _ = self.el.remove(self.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct AsyncFd {
|
pub struct AsyncFd {
|
||||||
pub(super) engine: Rc<AsyncEngine>,
|
pub(super) engine: Rc<AsyncEngine>,
|
||||||
pub(super) data: Rc<AsyncFdData>,
|
pub(super) data: Rc<AsyncFdData>,
|
||||||
|
|
@ -786,6 +780,7 @@ mod fd {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if self.data.ref_count.fetch_sub(1) == 1 {
|
if self.data.ref_count.fetch_sub(1) == 1 {
|
||||||
self.engine.fds.remove(&self.data.fd.raw());
|
self.engine.fds.remove(&self.data.fd.raw());
|
||||||
|
let _ = self.data.el.remove(self.data.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue