get read buf from inner filter for ssl filters

This commit is contained in:
Nikolay Kim 2021-12-22 17:52:16 +06:00
parent ab3c2efa66
commit 211eb00715
5 changed files with 10 additions and 8 deletions

View file

@ -144,7 +144,7 @@ impl IoState {
} }
#[inline] #[inline]
pub(super) fn shutdown_filters(&self) -> Result<(), io::Error> { pub(super) fn shutdown_filters(&self) -> io::Result<()> {
let mut flags = self.flags.get(); let mut flags = self.flags.get();
if !flags.intersects(Flags::IO_ERR | Flags::IO_SHUTDOWN) { if !flags.intersects(Flags::IO_ERR | Flags::IO_SHUTDOWN) {
let result = match self.filter.get().poll_shutdown() { let result = match self.filter.get().poll_shutdown() {

View file

@ -647,9 +647,7 @@ mod unixstream {
continue; continue;
} }
Poll::Ready(Err(e)) => { Poll::Ready(Err(e)) => {
log::trace!( log::trace!("write task is closed with err during shutdown");
"write task is closed with err during shutdown"
);
this.state.close(Some(e)); this.state.close(Some(e));
return Poll::Ready(()); return Poll::Ready(());
} }

View file

@ -264,10 +264,11 @@ impl<F: Filter> FilterFactory<F> for SslAcceptor {
let ssl = ctx_result.map_err(map_to_ioerr)?; let ssl = ctx_result.map_err(map_to_ioerr)?;
let pool = st.memory_pool(); let pool = st.memory_pool();
let st = st.map_filter(|inner: F| { let st = st.map_filter(|inner: F| {
let read_buf = inner.get_read_buf();
let inner = IoInner { let inner = IoInner {
pool, pool,
inner, inner,
read_buf: None, read_buf,
write_buf: None, write_buf: None,
}; };
let ssl_stream = ssl::SslStream::new(ssl, inner)?; let ssl_stream = ssl::SslStream::new(ssl, inner)?;
@ -315,10 +316,11 @@ impl<F: Filter> FilterFactory<F> for SslConnector {
let ssl = self.ssl; let ssl = self.ssl;
let pool = st.memory_pool(); let pool = st.memory_pool();
let st = st.map_filter(|inner: F| { let st = st.map_filter(|inner: F| {
let read_buf = inner.get_read_buf();
let inner = IoInner { let inner = IoInner {
pool, pool,
inner, inner,
read_buf: None, read_buf,
write_buf: None, write_buf: None,
}; };
let ssl_stream = ssl::SslStream::new(ssl, inner)?; let ssl_stream = ssl::SslStream::new(ssl, inner)?;

View file

@ -223,10 +223,11 @@ impl<F: Filter> TlsClientFilter<F> {
Err(error) => return Err(io::Error::new(io::ErrorKind::Other, error)), Err(error) => return Err(io::Error::new(io::ErrorKind::Other, error)),
}; };
let io = io.map_filter(|inner: F| { let io = io.map_filter(|inner: F| {
let read_buf = inner.get_read_buf();
let inner = IoInner { let inner = IoInner {
pool, pool,
inner, inner,
read_buf: None, read_buf,
write_buf: None, write_buf: None,
}; };

View file

@ -224,10 +224,11 @@ impl<F: Filter> TlsServerFilter<F> {
Err(error) => return Err(io::Error::new(io::ErrorKind::Other, error)), Err(error) => return Err(io::Error::new(io::ErrorKind::Other, error)),
}; };
let io = io.map_filter(|inner: F| { let io = io.map_filter(|inner: F| {
let read_buf = inner.get_read_buf();
let inner = IoInner { let inner = IoInner {
pool, pool,
inner, inner,
read_buf: None, read_buf,
write_buf: None, write_buf: None,
}; };