mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-08 21:08:04 -05:00
propagate closing in CopyFlush
This commit is contained in:
@@ -448,7 +448,6 @@ impl InnerState {
|
||||
|
||||
#[instrument(parent = &self.span, level = "debug", skip_all, err)]
|
||||
async fn server_close(mut self: Box<Self>) -> Result<Box<Self>, ProverError> {
|
||||
debug!("attempting to close connection serverside");
|
||||
self.tls.process_new_packets().await?;
|
||||
self.tls.server_closed().await?;
|
||||
debug!("closed connection serverside");
|
||||
|
||||
@@ -58,7 +58,8 @@ pin_project_lite::pin_project! {
|
||||
reader: R,
|
||||
#[pin]
|
||||
writer: W,
|
||||
buf: Vec<u8>
|
||||
buf: Vec<u8>,
|
||||
closed: bool
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +73,7 @@ where
|
||||
reader,
|
||||
writer,
|
||||
buf: Vec::with_capacity(BUF_CAP),
|
||||
closed: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,10 +93,14 @@ where
|
||||
|
||||
let mut tmp_buf = [0_u8; BUF_CAP];
|
||||
loop {
|
||||
if let Poll::Ready(read) = reader.as_mut().poll_read(cx, &mut tmp_buf)?
|
||||
&& read > 0
|
||||
if !*this.closed
|
||||
&& let Poll::Ready(read) = reader.as_mut().poll_read(cx, &mut tmp_buf)?
|
||||
{
|
||||
this.buf.extend(&tmp_buf[..read]);
|
||||
if read > 0 {
|
||||
this.buf.extend(&tmp_buf[..read]);
|
||||
} else {
|
||||
*this.closed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if this.buf.len() > 0
|
||||
@@ -102,6 +108,9 @@ where
|
||||
&& write > 0
|
||||
{
|
||||
this.buf.drain(..write);
|
||||
} else if *this.closed {
|
||||
let output = writer.as_mut().poll_close(cx)?;
|
||||
return output.map(|_| Ok(()));
|
||||
} else {
|
||||
return Poll::Pending;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user