Skip to content

Conversation

FranzBusch
Copy link
Member

Motivation

When adding new async methods for all the bootstrap we had to create 3 sets of method for every bootstrap. This resulted in lots of code and only provided little benefit for users.

Modification

This PR removes all bind/connect methods except the most generic ones. This leaves it up to the user to wrap their channels in a NIOAsyncChannel or to await the protocol negotiation result.

Result

Less code to maintain on our side.

Comment on lines 281 to 285
for try await childChannel in channel.inboundStream {
for try await negotiationResult in channel.inboundStream {
group.addTask {
switch childChannel {
switch try await negotiationResult.resolve() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part here is the important change. Instead of having a NIOAsyncChannel of negotiation results we now have a channel of futures of negotiation results. This means that users have to resolve the result and can then decide what to do with it. It doesn't look too bad from a users perspective and allows us to significantly reduce the amount of code in NIO. cc @Lukasa @glbrntt @rnro

@FranzBusch FranzBusch force-pushed the fb-reduce-bootstraps branch from 643d9b5 to c6eb536 Compare July 14, 2023 08:14
@FranzBusch FranzBusch marked this pull request as ready for review July 14, 2023 08:15
@FranzBusch FranzBusch force-pushed the fb-reduce-bootstraps branch 2 times, most recently from 8af30cb to c4f41b9 Compare July 17, 2023 09:06
# Motivation
When adding new async methods for all the bootstrap we had to create 3 sets of method for every bootstrap. This resulted in lots of code and only provided little benefit for users.

# Modification
This PR removes all bind/connect methods except the most generic ones. This leaves it up to the user to wrap their channels in a `NIOAsyncChannel` or to await the protocol negotiation result.

# Result
Less code to maintain on our side.
@FranzBusch FranzBusch force-pushed the fb-reduce-bootstraps branch from c4f41b9 to 5e47822 Compare July 17, 2023 09:12
@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Jul 21, 2023
@Lukasa Lukasa enabled auto-merge (squash) July 21, 2023 09:30
@FranzBusch FranzBusch disabled auto-merge July 21, 2023 10:00
@FranzBusch
Copy link
Member Author

  • 5.9 is a known allocation regression
  • Nightly is a known crash
  • API breakage is also expected

@Lukasa Could you merge this over the failing API breakage CI please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants