chore: fix some typos (#984)
Signed-off-by: cuishuang <[email protected]>
This commit is contained in:
@@ -27,7 +27,7 @@ async fn streaming_echo(client: &mut EchoClient<Channel>, num: usize) {
|
||||
// stream is infinite - take just 5 elements and then disconnect
|
||||
let mut stream = stream.take(num);
|
||||
while let Some(item) = stream.next().await {
|
||||
println!("\trecived: {}", item.unwrap().message);
|
||||
println!("\treceived: {}", item.unwrap().message);
|
||||
}
|
||||
// stream is droped here and the disconnect info is send to server
|
||||
}
|
||||
@@ -42,9 +42,9 @@ async fn bidirectional_streaming_echo(client: &mut EchoClient<Channel>, num: usi
|
||||
|
||||
let mut resp_stream = response.into_inner();
|
||||
|
||||
while let Some(recived) = resp_stream.next().await {
|
||||
let recived = recived.unwrap();
|
||||
println!("\trecived message: `{}`", recived.message);
|
||||
while let Some(received) = resp_stream.next().await {
|
||||
let received = received.unwrap();
|
||||
println!("\treceived message: `{}`", received.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ async fn bidirectional_streaming_echo_throttle(client: &mut EchoClient<Channel>,
|
||||
|
||||
let mut resp_stream = response.into_inner();
|
||||
|
||||
while let Some(recived) = resp_stream.next().await {
|
||||
let recived = recived.unwrap();
|
||||
println!("\trecived message: `{}`", recived.message);
|
||||
while let Some(received) = resp_stream.next().await {
|
||||
let received = received.unwrap();
|
||||
println!("\treceived message: `{}`", received.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
streaming_echo(&mut client, 5).await;
|
||||
tokio::time::sleep(Duration::from_secs(1)).await; //do not mess server println functions
|
||||
|
||||
// Echo stream that sends 17 requests then gracefull end that conection
|
||||
// Echo stream that sends 17 requests then graceful end that connection
|
||||
println!("\r\nBidirectional stream echo:");
|
||||
bidirectional_streaming_echo(&mut client, 17).await;
|
||||
|
||||
// Echo stream that sends up to `usize::MAX` requets. One request each 2s.
|
||||
// Exiting client with CTRL+C demostrate how to distinguise broken pipe from
|
||||
//gracefull client disconnection (above example) on the server side.
|
||||
// Exiting client with CTRL+C demonstrate how to distinguish broken pipe from
|
||||
//graceful client disconnection (above example) on the server side.
|
||||
println!("\r\nBidirectional stream echo (kill client with CTLR+C):");
|
||||
bidirectional_streaming_echo_throttle(&mut client, Duration::from_secs(2)).await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user