新增判断连接状态接口

This commit is contained in:
duanhf2012
2020-04-08 14:43:30 +08:00
parent 89fd5b8525
commit a0b02c7ec2
3 changed files with 13 additions and 0 deletions

View File

@@ -145,3 +145,8 @@ func GetRpcClient(nodeId int,serviceMethod string) ([]*rpc.Client,error) {
func GetRpcServer() *rpc.Server{
return &cluster.rpcServer
}
func (slf *Cluster) IsNodeConnected (nodeId int) bool {
pClient := slf.GetRpcClient(nodeId)
return pClient!=nil && pClient.IsConnected()
}