Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix grpc client dialing for tcp #33

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,18 @@ func startInProcess(parentCtx context.Context, ctx *Context, clientCtx client.Co
maxRecvMsgSize = serverconfig.DefaultGRPCMaxRecvMsgSize
}

grpcSrvAddrString := fmt.Sprintf("%s://%s", grpcSrvAddr.Network(), grpcSrvAddr.String())
var grpcSrvAddrString string
if grpcSrvAddr.Network() == "tcp" {
// Use original cosmos behavior for tcp.
_, port, err := net.SplitHostPort(grpcSrvAddr.String())
if err != nil {
return err
}
grpcSrvAddrString = fmt.Sprintf("127.0.0.1:%s", port)
} else {
// This can support UDS at the very least. See https://github.com/grpc/grpc/blob/master/doc/naming.md for details.
grpcSrvAddrString = fmt.Sprintf("%s://%s", grpcSrvAddr.Network(), grpcSrvAddr.String())
}
// If grpc is enabled, configure grpc client for grpc gateway.
grpcClient, err := grpc.Dial(
grpcSrvAddrString,
Expand Down
Loading