优化origin默认模式的服务发现

This commit is contained in:
boyce
2024-04-25 11:20:06 +08:00
parent 59efc05d24
commit bba5eb2929
15 changed files with 573 additions and 181 deletions

View File

@@ -10,7 +10,8 @@ import (
//跨结点连接的Client
type NatsClient struct {
localNodeId string
notifyEventFun NotifyEventFun
natsConn *nats.Conn
client *Client
}
@@ -85,5 +86,5 @@ func (rc *NatsClient) WriteMsg (nodeId string,args ...[]byte) error{
}
func (rc *NatsClient) IsConnected() bool{
return rc.natsConn.Status() == nats.CONNECTED
return rc.natsConn!=nil && rc.natsConn.Status() == nats.CONNECTED
}