From 39b862e3d900bfc61ce00d6c7e6400015f84cb86 Mon Sep 17 00:00:00 2001 From: duanhf2012 <6549168@qq.com> Date: Mon, 9 Oct 2023 16:57:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EIsNodeRetire=E5=87=BD?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=88=A4=E6=96=ADNodeId?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E4=B8=BARetire=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster/cluster.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cluster/cluster.go b/cluster/cluster.go index bcc0bfd..c2daaa7 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -350,6 +350,15 @@ func (cls *Cluster) IsNodeConnected(nodeId int) bool { 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) { cls.locker.Lock() nodeInfo, ok := cls.mapRpc[nodeId]