return an Err when read return 0 (#1503)
* return an Err when read return 0, instead of all zeroed buff without any error
This commit is contained in:
+6
-1
@@ -121,7 +121,12 @@ pub fn read_exact(
|
||||
let mut read = 0;
|
||||
loop {
|
||||
match conn.read(buf) {
|
||||
Ok(0) => break,
|
||||
Ok(0) => {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::ConnectionAborted,
|
||||
"read_exact",
|
||||
));
|
||||
}
|
||||
Ok(n) => {
|
||||
let tmp = buf;
|
||||
buf = &mut tmp[n..];
|
||||
|
||||
Reference in New Issue
Block a user