判断rpc连接状态

This commit is contained in:
duanhf2012
2020-04-02 21:46:13 +08:00
parent 3ff1c75232
commit 060fb6d34c

View File

@@ -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