mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 23:20:26 +08:00
调整GRPC参数
This commit is contained in:
@@ -265,12 +265,18 @@ func (this *APINode) InstallSystemService() error {
|
||||
// 启动RPC监听
|
||||
func (this *APINode) listenRPC(listener net.Listener, tlsConfig *tls.Config) error {
|
||||
var rpcServer *grpc.Server
|
||||
var options = []grpc.ServerOption{
|
||||
grpc.MaxRecvMsgSize(128 * 1024 * 1024),
|
||||
grpc.UnaryInterceptor(this.unaryInterceptor),
|
||||
}
|
||||
|
||||
if tlsConfig == nil {
|
||||
remotelogs.Println("API_NODE", "listening GRPC http://"+listener.Addr().String()+" ...")
|
||||
rpcServer = grpc.NewServer(grpc.MaxRecvMsgSize(128*1024*1024), grpc.UnaryInterceptor(this.unaryInterceptor))
|
||||
rpcServer = grpc.NewServer(options...)
|
||||
} else {
|
||||
logs.Println("[API_NODE]listening GRPC https://" + listener.Addr().String() + " ...")
|
||||
rpcServer = grpc.NewServer(grpc.Creds(credentials.NewTLS(tlsConfig)), grpc.MaxRecvMsgSize(128*1024*1024), grpc.UnaryInterceptor(this.unaryInterceptor))
|
||||
options = append(options, grpc.Creds(credentials.NewTLS(tlsConfig)))
|
||||
rpcServer = grpc.NewServer(options...)
|
||||
}
|
||||
this.registerServices(rpcServer)
|
||||
err := rpcServer.Serve(listener)
|
||||
|
||||
Reference in New Issue
Block a user