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