Skip to content

Commit 28acb7b

Browse files
committed
Gossip Comm probe: use gRPC dialOpts given
The probe implementation checks if the dial options is empty And then makes it insecure, but actually this slice of DialOpts can't be empty from the code flow. Change-Id: Ibfc787078cbf7bc4d343c48f225dfcd30822f41f Signed-off-by: Yacov Manevich <[email protected]>
1 parent f9e8f3b commit 28acb7b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

gossip/comm/comm_impl.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ func SetDialTimeout(timeout time.Duration) {
6060
}
6161

6262
func (c *commImpl) SetDialOpts(opts ...grpc.DialOption) {
63+
if len(opts) == 0 {
64+
c.logger.Warning("Given an empty set of grpc.DialOption, aborting")
65+
return
66+
}
6367
c.opts = opts
6468
}
6569

@@ -262,13 +266,7 @@ func (c *commImpl) Probe(remotePeer *RemotePeer) error {
262266
return fmt.Errorf("Stopping")
263267
}
264268
c.logger.Debug("Entering, endpoint:", endpoint, "PKIID:", pkiID)
265-
var err error
266-
267-
opts := c.opts
268-
if opts == nil {
269-
opts = []grpc.DialOption{grpc.WithInsecure(), grpc.WithTimeout(dialTimeout)}
270-
}
271-
cc, err := grpc.Dial(endpoint, append(opts, grpc.WithBlock())...)
269+
cc, err := grpc.Dial(remotePeer.Endpoint, append(c.opts, grpc.WithBlock())...)
272270
if err != nil {
273271
c.logger.Debug("Returning", err)
274272
return err

0 commit comments

Comments
 (0)