Struct openssh_sftp_client::ReadEnd
source · [−]pub struct ReadEnd<Buffer: ToBuffer + 'static> { /* private fields */ }
Implementations
Precondition: self.wait_for_new_request()
must not be 0.
Example
ⓘ
let readend = ...;
loop {
let new_requests_submit = readend.wait_for_new_request().await;
if new_requests_submit == 0 {
break;
}
// If attempt to read in more than new_requests_submit, then
// `read_in_one_packet` might block forever.
for _ in 0..new_requests_submit {
readend.read_in_one_packet().await.unwrap();
}
}
Return number of requests sent and number of responses to read in. Read 0 if the connection is closed.
You must call this function in a loop, break if this function returns
0, otherwise call read_in_one_packet
for n
times where n
in the
return value of this function, then repeat.