Skip to content

Commit 825fabb

Browse files
committed
Async client example: Don't close twice
As far as i can tell, the server doesn't initiate the close handshake, so the client should just consider the handshake finished when it receives the acknowledgment and probably just wait for the server to close the underlying connection. This stops if from trying to start a second close handshake. It's not exactly clear to me how this avoids dropping the underlying connection before the server closes it now??? There is also a warning: ``` warning: unused `futures::stream::Select` in tuple element 0 that must be used --> examples/async-client.rs:67:2 | 67 | runtime.block_on(runner).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_must_use)]` on by default = note: streams do nothing unless polled ``` Given how convoluted types get here, I haven't exactly bothered getting to the bottom of this warning. I think some extra comments would be nice in example code.
1 parent cf93460 commit 825fabb

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

examples/async-client.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ fn main() {
5656
.filter_map(|message| {
5757
println!("Received Message: {:?}", message);
5858
match message {
59-
OwnedMessage::Close(e) => Some(OwnedMessage::Close(e)),
6059
OwnedMessage::Ping(d) => Some(OwnedMessage::Pong(d)),
6160
_ => None,
6261
}

0 commit comments

Comments
 (0)