frostfs-node/cmd/neofs-node/grpc.go
Alex Vanin 861bac3892 [#59] Use max msg size in transport server and splitter
For GRPC it is about 4 MiB.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-02 11:25:36 +03:00

32 lines
515 B
Go

package main
import (
"fmt"
"net"
"google.golang.org/grpc"
)
func initGRPC(c *cfg) {
var err error
c.cfgGRPC.listener, err = net.Listen("tcp", c.viper.GetString(cfgListenAddress))
fatalOnErr(err)
c.cfgGRPC.server = grpc.NewServer(
grpc.MaxSendMsgSize(c.viper.GetInt(cfgMaxMsgSize)),
)
}
func serveGRPC(c *cfg) {
go func() {
c.wg.Add(1)
defer func() {
c.wg.Done()
}()
if err := c.cfgGRPC.server.Serve(c.cfgGRPC.listener); err != nil {
fmt.Println("gRPC server error", err)
}
}()
}