Skip to content

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Nov 24, 2021

Log BalancerAddress instead of DnsEndPoint because it has a more friendly ToString

Before:

Successfully picked subchannel id '1' with address Undefined/127.0.0.1:50051.

After:

Successfully picked subchannel id '1' with address 127.0.0.1:50051.

@JamesNK JamesNK requested a review from captainsafia November 24, 2021 04:11
Task<(Subchannel Subchannel, DnsEndPoint Address, Action<CompleteContext> OnComplete)>
#endif
PickAsync(PickContext context, bool waitForReady, CancellationToken cancellationToken)
public async ValueTask<(Subchannel Subchannel, BalancerAddress Address, Action<CompletionContext> OnComplete)> PickAsync(PickContext context, bool waitForReady, CancellationToken cancellationToken)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it OK to remove the if-def here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Originally I wrote this code to support netstandard2.0. It ended up being net5.0 or later. This is an unused ifdef that didn't get removed.

/// </summary>
internal class SocketConnectivitySubchannelTransport : ISubchannelTransport, IDisposable
{
internal record struct ActiveStream(BalancerAddress Address, Socket Socket, Stream? Stream);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice use of record structs here!

Copy link
Member Author

Choose a reason for hiding this comment

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

Friendship ended with tuples.
Now record structs is my best friend.

Copy link
Contributor

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

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

Looks good overall!

Left one comment about a removed if-def that looks awry.

@JamesNK JamesNK merged commit 16a1bb4 into grpc:master Nov 30, 2021
@JamesNK JamesNK deleted the jamesnk/loadbalancing-logaddress branch November 30, 2021 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants