frostfs-node/cmd/neofs-node/grpc.go
Leonard Lyubich cd19183d3e [#13] neofs-node: Use execution Object service in app
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-02 11:25:35 +03:00

30 lines
442 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.cfgGRPC.endpoint)
fatalOnErr(err)
c.cfgGRPC.server = grpc.NewServer()
}
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)
}
}()
}