This commit is contained in:
djc
2022-01-25 09:19:45 +00:00
parent ca0837149e
commit f1f32978ef
4 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -526,8 +526,8 @@ For example, from the connection initiator to the peer and the other way around.
<span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>async fn receive_bidirectional_stream(mut connection: NewConnection) -&gt; anyhow::Result&lt;()&gt; {
while let Some(Ok((send, recv))) = connection.bi_streams.next().await {
// Because it is a bidirectional stream, we can both send and recieve.
while let Some(Ok((mut send, recv))) = connection.bi_streams.next().await {
// Because it is a bidirectional stream, we can both send and receive.
println!(&quot;request: {:?}&quot;, recv.read_to_end(50).await?);
send.write_all(b&quot;response&quot;).await?;
+2 -2
View File
@@ -179,8 +179,8 @@ For example, from the connection initiator to the peer and the other way around.
<span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>async fn receive_bidirectional_stream(mut connection: NewConnection) -&gt; anyhow::Result&lt;()&gt; {
while let Some(Ok((send, recv))) = connection.bi_streams.next().await {
// Because it is a bidirectional stream, we can both send and recieve.
while let Some(Ok((mut send, recv))) = connection.bi_streams.next().await {
// Because it is a bidirectional stream, we can both send and receive.
println!(&quot;request: {:?}&quot;, recv.read_to_end(50).await?);
send.write_all(b&quot;response&quot;).await?;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long