tor-proto: simplify `ConfluxSet::circuit_action`
3 unresolved threads
3 unresolved threads
This simplifies the call signature of ConfluxSet::circuit_action
, and renames it to ConfluxSet::next_circ_action
. It now returns a Future
instead of a Stream
since we only ever use the first item in Reactor::run_once
.
@gabi-250 I think these changes make things a bit nicer, but these changes are all opinionated, and I don't feel strongly either way, so feel free to veto them or suggest changes if you don't think they improve things.
/cc @dgoulet
Edited by opara
Merge request reports
Activity
requested review from @opara
assigned to @opara
186 197 } 187 198 } 188 199 200 /// Flatten a `Result<Result<T, E>, E>` into a `Result<T, E>`. 201 /// 202 /// See the nightly [`Result::flatten`]. 203 fn flatten<T, E>(x: Result<Result<T, E>, E>) -> Result<T, E> { changed this line in version 3 of the diff
Moved this to
tor-basic-utils
in 49c02757.
176 181 // Note: We don't actually use the returned SinkSendable, 177 182 // and continue writing to the SometimesUboundedSink in the reactor :( 178 183 .map(|res| res.map(|res| res.0)) 184 // We only return the first ready action as a Future. 185 // Can't use `next()` since it borrows the stream. 186 .into_future() 537 537 let msg = unwrap_or_shutdown!(self, ret, "control drop")?; 538 538 Some(CircuitAction::HandleControl(msg)) 539 539 }, 540 res = circ_actions.next().fuse() => { 541 unwrap_or_shutdown!(self, res, "empty conflux set")??? 542 } 540 res = circ_actions.fuse() => res?, added 1 commit
- 49c02757 - tor-basic-utils: move `flatten` from tor-proto
enabled an automatic merge when all merge checks for 49c02757 pass
mentioned in commit 8cf4c826
Please register or sign in to reply