Skip to content

Commit

Permalink
Gossip Comm probe: use gRPC dialOpts given
Browse files Browse the repository at this point in the history
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 <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Dec 18, 2016
1 parent f9e8f3b commit 28acb7b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions gossip/comm/comm_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func SetDialTimeout(timeout time.Duration) {
}

func (c *commImpl) SetDialOpts(opts ...grpc.DialOption) {
if len(opts) == 0 {
c.logger.Warning("Given an empty set of grpc.DialOption, aborting")
return
}
c.opts = opts
}

Expand Down Expand Up @@ -262,13 +266,7 @@ func (c *commImpl) Probe(remotePeer *RemotePeer) error {
return fmt.Errorf("Stopping")
}
c.logger.Debug("Entering, endpoint:", endpoint, "PKIID:", pkiID)
var err error

opts := c.opts
if opts == nil {
opts = []grpc.DialOption{grpc.WithInsecure(), grpc.WithTimeout(dialTimeout)}
}
cc, err := grpc.Dial(endpoint, append(opts, grpc.WithBlock())...)
cc, err := grpc.Dial(remotePeer.Endpoint, append(c.opts, grpc.WithBlock())...)
if err != nil {
c.logger.Debug("Returning", err)
return err
Expand Down

0 comments on commit 28acb7b

Please sign in to comment.