Fix tight loop on aborted connection (#285)
When the underlying IO returns 0 on read, we must stop polling it since it's closed. Otherwise we'll be stuck in a tight loop. this fixes https://github.com/sfackler/rust-openssl/issues/949
This commit is contained in:
committed by
Carl Lerche
parent
2b59803866
commit
74a5e072fe
@@ -329,7 +329,7 @@ impl io::Write for Mock {
|
||||
let mut me = self.pipe.inner.lock().unwrap();
|
||||
|
||||
if me.closed {
|
||||
return Err(io::Error::new(io::ErrorKind::BrokenPipe, "mock closed"));
|
||||
return Ok(buf.len());
|
||||
}
|
||||
|
||||
if me.tx_rem == 0 {
|
||||
|
||||
Reference in New Issue
Block a user