From 99b026b45ee02269c67481c56625111a6c9c4717 Mon Sep 17 00:00:00 2001 From: boyce <6549168@qq.com> Date: Mon, 3 Jun 2019 19:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=B0=83=E7=94=A8=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0rpc=E5=87=BA=E9=94=99=E6=97=B6=EF=BC=8C=E7=AE=A1?= =?UTF-8?q?=E9=81=93=E8=BF=9E=E6=8E=A5=E4=BC=9A=E4=BA=A7=E7=94=9F=E6=96=AD?= =?UTF-8?q?=E5=BC=80=EF=BC=8C=E6=97=A0=E6=B3=95=E8=87=AA=E5=8A=A8=E9=87=8D?= =?UTF-8?q?=E8=BF=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster/cluster.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cluster/cluster.go b/cluster/cluster.go index 2863349..0852c36 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -101,13 +101,15 @@ func (slf *CCluster) ListenService() error { os.Exit(1) return err2 } + go slf.AcceptRpc(tcplisten) + slf.ReSetLocalRpcClient() + return nil +} +func (slf *CCluster) ReSetLocalRpcClient() { slf.reader, slf.writer = net.Pipe() go rpc.ServeConn(slf.reader) slf.LocalRpcClient = rpc.NewClient(slf.writer) - - go slf.AcceptRpc(tcplisten) - return nil } type CPing struct { @@ -172,6 +174,9 @@ func (slf *CCluster) ConnService() error { v.pclient = client } + if slf.LocalRpcClient.IsClosed() { + slf.ReSetLocalRpcClient() + } time.Sleep(time.Second * 4) }