Commit c62ec481 authored by duanjinfei's avatar duanjinfei

fix grpc conn Multiplexing

parent 79f72a39
......@@ -9,8 +9,20 @@ import (
"google.golang.org/grpc/credentials/insecure"
)
var (
rpcClientMap map[string]*grpc.ClientConn
)
func init() {
rpcClientMap = make(map[string]*grpc.ClientConn, 0)
}
func ConnNmGrpc(endpoint string) nodemanagerV2.NodeManagerServiceClient {
conn := connGrpc(endpoint)
conn := rpcClientMap[endpoint]
if conn == nil {
conn = connGrpc(endpoint)
rpcClientMap[endpoint] = conn
}
if conn != nil {
return nodemanagerV2.NewNodeManagerServiceClient(conn)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment