From 060fb6d34cbb173fec5815b0e4c8e324c8c47eba Mon Sep 17 00:00:00 2001 From: duanhf2012 Date: Thu, 2 Apr 2020 21:46:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=ADrpc=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc/client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rpc/client.go b/rpc/client.go index 60db410..c308f4e 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -122,6 +122,11 @@ func (slf *Client) Go(noReply bool,serviceMethod string, args interface{},reply return call } + if slf.conn == nil { + call.Err = fmt.Errorf("call %s is fail,rpc client is disconnect.",serviceMethod) + return call + } + err = slf.conn.WriteMsg(bytes) if err != nil { call.Err = err