mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-11 04:54:42 +08:00
如果id为本地node,直接返回localrpcclient
This commit is contained in:
@@ -45,6 +45,10 @@ func (slf *CCluster) ReadNodeInfo(nodeid int) error {
|
||||
}
|
||||
|
||||
func (slf *CCluster) GetClusterClient(id int) *rpc.Client {
|
||||
if id == GetNodeId() {
|
||||
return slf.LocalRpcClient
|
||||
}
|
||||
|
||||
v, ok := slf.nodeclient[id]
|
||||
if ok == false {
|
||||
return nil
|
||||
@@ -130,12 +134,14 @@ func (slf *CCluster) ConnService() error {
|
||||
if rpcClient.isConnect == true {
|
||||
ping.TimeStamp = 0
|
||||
err := rpcClient.pclient.Call("CPing.Ping", &ping, &pong)
|
||||
|
||||
if err != nil {
|
||||
rpcClient.pclient.Close()
|
||||
rpcClient.pclient = nil
|
||||
rpcClient.isConnect = false
|
||||
continue
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user