Skip to content

Commit

Permalink
examples: fix debugging example after Dial->NewClient migration (#7833)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley authored Nov 13, 2024
1 parent 8c518f7 commit a365199
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/features/debugging/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ func main() {

/***** Initialize manual resolver and Dial *****/
r := manual.NewBuilderWithScheme("whatever")
r.InitialState(resolver.State{Addresses: []resolver.Address{{Addr: ":10001"}, {Addr: ":10002"}, {Addr: ":10003"}}})
// Set up a connection to the server.
conn, err := grpc.NewClient(r.Scheme()+":///test.server", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r), grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`))
if err != nil {
log.Fatalf("did not connect: %v", err)
}
defer conn.Close()
// Manually provide resolved addresses for the target.
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: ":10001"}, {Addr: ":10002"}, {Addr: ":10003"}}})

c := pb.NewGreeterClient(conn)

Expand Down
2 changes: 1 addition & 1 deletion examples/features/debugging/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *slowServer) SayHello(_ context.Context, in *pb.HelloRequest) (*pb.Hello

func main() {
/***** Set up the server serving channelz service. *****/
lis, err := net.Listen("tcp", ":50051")
lis, err := net.Listen("tcp", ":50052")
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
Expand Down

0 comments on commit a365199

Please sign in to comment.