Skip to content

Commit b50ac1e

Browse files
committed
fix(tls): avoid infinite loop
1 parent 10158d5 commit b50ac1e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

compio-tls/src/stream/rtls.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ impl<S: io::Read> TlsStream<S> {
9696
fn read_impl<T>(&mut self, mut f: impl FnMut(Reader) -> io::Result<T>) -> io::Result<T> {
9797
loop {
9898
while self.conn.wants_read() {
99-
self.conn.read_tls(&mut self.inner)?;
99+
if self.conn.read_tls(&mut self.inner)? == 0 {
100+
break;
101+
}
100102
self.conn.process_new_packets().map_err(io::Error::other)?;
101103
}
102104

0 commit comments

Comments
 (0)