新增IsNodeRetire函数,用于判断NodeId是否为Retire状态

This commit is contained in:
duanhf2012
2023-10-09 16:57:05 +08:00
parent 8c9b796fce
commit 39b862e3d9

View File

@@ -350,6 +350,15 @@ func (cls *Cluster) IsNodeConnected(nodeId int) bool {
return pClient != nil && pClient.IsConnected() return pClient != nil && pClient.IsConnected()
} }
func (cls *Cluster) IsNodeRetire(nodeId int) bool {
cls.locker.RLock()
defer cls.locker.RUnlock()
_,retire :=cls.getRpcClient(nodeId)
return retire
}
func (cls *Cluster) triggerRpcEvent(bConnect bool, clientId uint32, nodeId int) { func (cls *Cluster) triggerRpcEvent(bConnect bool, clientId uint32, nodeId int) {
cls.locker.Lock() cls.locker.Lock()
nodeInfo, ok := cls.mapRpc[nodeId] nodeInfo, ok := cls.mapRpc[nodeId]