Skip to content

Commit 2768f92

Browse files
committed
[CLOB-930] Add support for domain sockets for gRPC server and gRPC.
ctx.Done() support was added in 0.50 with cosmos#15041 server start up time was removed in 0.50 with cosmos#15041
1 parent 53f0196 commit 2768f92

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

server/grpc/server.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"net"
7+
"strings"
78

89
"google.golang.org/grpc"
910

@@ -74,7 +75,17 @@ func NewGRPCServer(clientCtx client.Context, app types.Application, cfg config.G
7475
// Otherwise, an error is returned. The caller is expected to provide a Context
7576
// that is properly canceled or closed to indicate the server should be stopped.
7677
func StartGRPCServer(ctx context.Context, logger log.Logger, cfg config.GRPCConfig, grpcSrv *grpc.Server) error {
77-
listener, err := net.Listen("tcp", cfg.Address)
78+
var proto, addr string
79+
parts := strings.SplitN(cfg.Address, "://", 2)
80+
// Default to using 'tcp' to maintain backwards compatibility with configurations that don't specify
81+
// the network to use.
82+
if len(parts) != 2 {
83+
proto = "tcp"
84+
addr = cfg.Address
85+
} else {
86+
proto, addr = parts[0], parts[1]
87+
}
88+
listener, err := net.Listen(proto, addr)
7889
if err != nil {
7990
return fmt.Errorf("failed to listen on address %s: %w", cfg.Address, err)
8091
}

0 commit comments

Comments
 (0)