mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-04 13:27:39 +03:00
Fix error handing for nested filters
This commit is contained in:
parent
8b3a1bc474
commit
89f758f8c4
15 changed files with 71 additions and 75 deletions
|
@ -31,19 +31,16 @@ impl ReadContext {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn release_read_buf(&self, buf: BytesMut, nbytes: usize) -> Result<(), io::Error> {
|
||||
pub fn release_read_buf(&self, buf: BytesMut, nbytes: usize) {
|
||||
if buf.is_empty() {
|
||||
self.0.memory_pool().release_read_buf(buf);
|
||||
Ok(())
|
||||
} else {
|
||||
let filter = self.0.filter();
|
||||
let mut dst = self.0 .0.read_buf.take();
|
||||
let result = self.0.filter().release_read_buf(buf, &mut dst, nbytes);
|
||||
let result = filter.release_read_buf(buf, &mut dst, nbytes);
|
||||
let nbytes = result.as_ref().map(|i| *i).unwrap_or(0);
|
||||
|
||||
if let Some(dst) = dst {
|
||||
if self.0.flags().contains(Flags::IO_FILTERS) {
|
||||
self.0 .0.shutdown_filters()?;
|
||||
}
|
||||
if nbytes > 0 {
|
||||
if dst.len() > self.0.memory_pool().read_params().high as usize {
|
||||
log::trace!(
|
||||
|
@ -66,11 +63,13 @@ impl ReadContext {
|
|||
if let Err(err) = result {
|
||||
self.0 .0.dispatch_task.wake();
|
||||
self.0 .0.insert_flags(Flags::RD_READY);
|
||||
Err(err)
|
||||
} else {
|
||||
Ok(())
|
||||
filter.want_shutdown(Some(err));
|
||||
}
|
||||
}
|
||||
|
||||
if self.0.flags().contains(Flags::IO_FILTERS) {
|
||||
self.0 .0.shutdown_filters();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +121,7 @@ impl WriteContext {
|
|||
}
|
||||
|
||||
if flags.contains(Flags::IO_FILTERS) {
|
||||
self.0 .0.shutdown_filters()?;
|
||||
self.0 .0.shutdown_filters();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue