mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 15:04:45 +08:00
检查nodeid是否在线,默认将自己结点认为在线状态
This commit is contained in:
@@ -317,6 +317,10 @@ func (slf *CCluster) GetNodeIdByServiceName(servicename string, bOnline bool) []
|
||||
}
|
||||
|
||||
func (slf *CCluster) CheckNodeIsConnectedByID(nodeid int) bool {
|
||||
if nodeid == GetNodeId() {
|
||||
return true
|
||||
}
|
||||
|
||||
pclient := slf.GetRpcClientByNodeId(nodeid)
|
||||
if pclient == nil {
|
||||
return false
|
||||
@@ -326,6 +330,7 @@ func (slf *CCluster) CheckNodeIsConnectedByID(nodeid int) bool {
|
||||
}
|
||||
|
||||
func (slf *CCluster) GetRpcClientByNodeId(nodeid int) *RpcClient {
|
||||
|
||||
pclient, ok := slf.nodeclient[nodeid]
|
||||
if ok == false {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user