mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-21 12:14: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 {
|
func (slf *CCluster) CheckNodeIsConnectedByID(nodeid int) bool {
|
||||||
|
if nodeid == GetNodeId() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
pclient := slf.GetRpcClientByNodeId(nodeid)
|
pclient := slf.GetRpcClientByNodeId(nodeid)
|
||||||
if pclient == nil {
|
if pclient == nil {
|
||||||
return false
|
return false
|
||||||
@@ -326,6 +330,7 @@ func (slf *CCluster) CheckNodeIsConnectedByID(nodeid int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (slf *CCluster) GetRpcClientByNodeId(nodeid int) *RpcClient {
|
func (slf *CCluster) GetRpcClientByNodeId(nodeid int) *RpcClient {
|
||||||
|
|
||||||
pclient, ok := slf.nodeclient[nodeid]
|
pclient, ok := slf.nodeclient[nodeid]
|
||||||
if ok == false {
|
if ok == false {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user