Skip to content

Commit b985581

Browse files
committed
Address review comments
1 parent aeabe41 commit b985581

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

examples/features/dualstack/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The dualstack example uses a custom name resolver that provides both IPv4 and
44
IPv6 localhost endpoints for each of 3 server instances. The client will first
5-
use the default name resolver and load balancers which will only connect tot he
5+
use the default name resolver and load balancers which will only connect to the
66
first server. It will then use the custom name resolver with round robin to
77
connect to each of the servers in turn. The 3 instances of the server will bind
88
respectively to: both IPv4 and IPv6, IPv4 only, and IPv6 only.
@@ -13,10 +13,10 @@ Three servers are serving on the following loopback addresses:
1313
1. `127.0.0.1:50050`: Listening only on the IPv4 loopback address.
1414
1. `[::1]:50051`: Listening only on the IPv6 loopback address.
1515

16-
The server response will include the include their serving port and address type
17-
(IPv4, IPv6 or both). So the server on "127.0.0.1:50050" will reply to the RPC
18-
with the following message: `Greeting:Hello request:1 from server<50052> type:
19-
IPv4 only)`.
16+
The server response will include its serving port and address type (IPv4, IPv6
17+
or both). So the server on "127.0.0.1:50050" will reply to the RPC with the
18+
following message: `Greeting:Hello request:1 from server<50052> type: IPv4
19+
only)`.
2020

2121
## Try it
2222

examples/features/dualstack/client/main.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ func (*exampleResolver) Scheme() string {
8484
}
8585

8686
func main() {
87-
// First it sends 5 requests using the default DNS and pickfirst load
88-
// balancer.
87+
// First send 5 requests using the default DNS and pickfirst load balancer.
8988
log.Print("**** Use default DNS resolver ****")
9089
target := fmt.Sprintf("localhost:%d", port1)
9190
cc, err := grpc.NewClient(target, grpc.WithTransportCredentials(insecure.NewCredentials()))
@@ -122,8 +121,7 @@ func main() {
122121
// Send 10 requests using the example nameresolver and round robin load
123122
// balancer. These requests are evenly distributed among the 3 servers
124123
// rather than favoring the server listening on both addresses because the
125-
// resolver groups the 3 servers as 3 endpoints each
126-
// with 2 addresses.
124+
// resolver groups the 3 servers as 3 endpoints each with 2 addresses.
127125
if err := waitForDistribution(ctx, client); err != nil {
128126
log.Panic(err)
129127
}
@@ -139,7 +137,7 @@ func waitForDistribution(ctx context.Context, client hwpb.GreeterClient) error {
139137
// Since the IPv6 address comes first in the resolver list, it will be
140138
// given higher priority.
141139
fmt.Sprintf("[::1]:%d", port1),
142-
// Server 1 is listening only on the IPv4 loopback address.
140+
// Server 2 is listening only on the IPv4 loopback address.
143141
fmt.Sprintf("127.0.0.1:%d", port2),
144142
// Server 3 is listening only on the IPv6 loopback address.
145143
fmt.Sprintf("[::1]:%d", port3),

examples/features/dualstack/server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func main() {
7575
go func() {
7676
defer wg.Done()
7777
if err := s.Serve(lis); err != nil {
78-
log.Fatalf("failed to serve: %v", err)
78+
log.Panicf("failed to serve: %v", err)
7979
}
8080
}()
8181
log.Printf("serving on %s\n", bindAddr)

0 commit comments

Comments
 (0)