Skip to content

Commit

Permalink
fix grpc dialer
Browse files Browse the repository at this point in the history
  • Loading branch information
ginuerzh committed Mar 20, 2023
1 parent f32b72c commit 661953e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 0 additions & 3 deletions config/parsing/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ func ParseHop(cfg *config.HopConfig) (chain.Hop, error) {
})

serverName, _, _ := net.SplitHostPort(v.Addr)
if serverName == "" {
serverName = "localhost"
}

tlsCfg := v.Connector.TLS
if tlsCfg == nil {
Expand Down
9 changes: 3 additions & 6 deletions dialer/grpc/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,14 @@ func (d *grpcDialer) Dial(ctx context.Context, addr string, opts ...dialer.DialO
opt(&options)
}

adr := addr
if h, p, err := net.SplitHostPort(addr); err == nil && h == "" {
adr = net.JoinHostPort("localhost", p)
}
host := d.md.host
if host == "" {
host = adr
host = options.Host
}
if h, _, _ := net.SplitHostPort(host); h != "" {
host = h
}
// d.options.Logger.Infof("grpc dialer, addr %s, host %s/%s", addr, d.md.host, options.Host)

grpcOpts := []grpc.DialOption{
// grpc.WithBlock(),
Expand Down Expand Up @@ -97,7 +94,7 @@ func (d *grpcDialer) Dial(ctx context.Context, addr string, opts ...dialer.DialO
}))
}

cc, err := grpc.DialContext(ctx, adr, grpcOpts...)
cc, err := grpc.DialContext(ctx, addr, grpcOpts...)
if err != nil {
d.options.Logger.Error(err)
return nil, err
Expand Down

0 comments on commit 661953e

Please sign in to comment.