-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Stream::select2
to support short-circuited select
#1422
base: master
Are you sure you want to change the base?
Conversation
3d3f7f1
to
c66304c
Compare
The way this API works today, it's impossible to know which stream was the one that completed, which seems like it would be necessary for this sort of retry behavior. Is that not the case? |
Yes, we don't know which one completes, maybe we can add this capability, but it is not necessary in this case, because we can retry the combined As in this case: When the websocket server is stopped, an TCP
Details: server (127.0.0.1.2794), client (127.0.0.1.62945)Server stopped in the
|
@cramertj @alexcrichton ping :) |
TBH I'm not really sure what to do with this. This seems like a pretty uncommon case to me, and you could replicate this behavior by e.g. using |
As discussed in websockets-rs/rust-websocket#136
Often, we have two streams combined by
select
:The stream of network events will complete when there is a network failure or something else, but the auxiliary stream often never completes.
When network steam completes, some actions should be take, such as a retry. But because the combined stream doesn't complete, we have no means to know whether the network steam have completed.
With the added
Stream::select2
andshort_circuit
beingtrue
, the returned stream completes when one of the two input stream completes, which is suitable for situations like this.