Simplify if condition
This commit is contained in:
+1
-3
@@ -31,14 +31,12 @@ fn read_body<T: Read + Write>(length: u32, socket: &mut ProxySocket<T>) {
|
|||||||
let stdin = io::stdin();
|
let stdin = io::stdin();
|
||||||
let mut handle = stdin.lock();
|
let mut handle = stdin.lock();
|
||||||
|
|
||||||
if let Ok(_) = handle.read_exact(&mut buffer) {
|
if handle.read_exact(&mut buffer).is_ok() && valid_length(length) {
|
||||||
if valid_length(length) {
|
|
||||||
socket.write_all(&buffer).unwrap();
|
socket.write_all(&buffer).unwrap();
|
||||||
socket.flush().unwrap();
|
socket.flush().unwrap();
|
||||||
read_response(socket);
|
read_response(socket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn read_response<T: Read>(socket: &mut ProxySocket<T>) {
|
fn read_response<T: Read>(socket: &mut ProxySocket<T>) {
|
||||||
let mut buf = vec![0; BUFFER_SIZE as usize];
|
let mut buf = vec![0; BUFFER_SIZE as usize];
|
||||||
|
|||||||
Reference in New Issue
Block a user