Change NewClientConn so that all options need to be specified by caller

This commit is contained in:
Menghan Li
2016-04-28 14:38:30 -07:00
parent 7a5269acfe
commit add9c0b9f2
2 changed files with 2 additions and 5 deletions

View File

@ -192,9 +192,6 @@ func DoGenericStreamingRoundTrip(stream testpb.BenchmarkService_StreamingCallCli
// NewClientConn creates a gRPC client connection to addr. // NewClientConn creates a gRPC client connection to addr.
func NewClientConn(addr string, opts ...grpc.DialOption) *grpc.ClientConn { func NewClientConn(addr string, opts ...grpc.DialOption) *grpc.ClientConn {
if len(opts) <= 0 {
opts = append(opts, grpc.WithInsecure())
}
conn, err := grpc.Dial(addr, opts...) conn, err := grpc.Dial(addr, opts...)
if err != nil { if err != nil {
grpclog.Fatalf("NewClientConn(%q) failed to create a ClientConn %v", addr, err) grpclog.Fatalf("NewClientConn(%q) failed to create a ClientConn %v", addr, err)

View File

@ -18,7 +18,7 @@ func runUnary(b *testing.B, maxConcurrentCalls int) {
b.StopTimer() b.StopTimer()
target, stopper := StartServer("localhost:0") target, stopper := StartServer("localhost:0")
defer stopper() defer stopper()
conn := NewClientConn(target) conn := NewClientConn(target, grpc.WithInsecure())
tc := testpb.NewBenchmarkServiceClient(conn) tc := testpb.NewBenchmarkServiceClient(conn)
// Warm up connection. // Warm up connection.
@ -61,7 +61,7 @@ func runStream(b *testing.B, maxConcurrentCalls int) {
b.StopTimer() b.StopTimer()
target, stopper := StartServer("localhost:0") target, stopper := StartServer("localhost:0")
defer stopper() defer stopper()
conn := NewClientConn(target) conn := NewClientConn(target, grpc.WithInsecure())
tc := testpb.NewBenchmarkServiceClient(conn) tc := testpb.NewBenchmarkServiceClient(conn)
// Warm up connection. // Warm up connection.