mirror of
https://github.com/fullstorydev/grpcurl.git
synced 2026-05-22 19:51:44 +03:00
allow callers of BlockingDial to override grpc.FailOnNonTempDialError dial option (#241)
This commit is contained in:
12
grpcurl.go
12
grpcurl.go
@@ -635,11 +635,13 @@ func BlockingDial(ctx context.Context, network, address string, creds credential
|
|||||||
// know when we're done. So we run it in a goroutine and then use result
|
// know when we're done. So we run it in a goroutine and then use result
|
||||||
// channel to either get the connection or fail-fast.
|
// channel to either get the connection or fail-fast.
|
||||||
go func() {
|
go func() {
|
||||||
opts = append(opts,
|
// We put grpc.FailOnNonTempDialError *before* the explicitly provided
|
||||||
grpc.WithBlock(),
|
// options so that it could be overridden.
|
||||||
grpc.FailOnNonTempDialError(true),
|
opts = append([]grpc.DialOption{grpc.FailOnNonTempDialError(true)}, opts...)
|
||||||
grpc.WithContextDialer(dialer),
|
// But we don't want caller to be able to override these two, so we put
|
||||||
)
|
// them *after* the explicitly provided options.
|
||||||
|
opts = append(opts, grpc.WithBlock(), grpc.WithContextDialer(dialer))
|
||||||
|
|
||||||
if creds == nil {
|
if creds == nil {
|
||||||
opts = append(opts, grpc.WithInsecure())
|
opts = append(opts, grpc.WithInsecure())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user