Skip to content

Commit

Permalink
Merge "Gossip Comm probe: use gRPC dialOpts given"
Browse files Browse the repository at this point in the history
  • Loading branch information
christo4ferris authored and Gerrit Code Review committed Dec 18, 2016
2 parents 8d53e6d + 28acb7b commit b48f46d
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 b48f46d

Please sign in to comment.