Skip to content

Commit

Permalink
机器名变更时,节点名同步变更
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 11, 2023
1 parent 0fd234e commit 5c98259
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Stardust.Data/Nodes/节点.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,11 @@ public void Fill(NodeInfo di)
if (!di.Version.IsNullOrEmpty()) node.Version = di.Version;
if (di.Compile.Year > 2000) node.CompileTime = di.Compile;

if (!di.MachineName.IsNullOrEmpty()) node.MachineName = di.MachineName;
if (!di.MachineName.IsNullOrEmpty())
{
if (node.Name.IsNullOrEmpty() || node.Name == node.MachineName) node.Name = di.MachineName;
node.MachineName = di.MachineName;
}
if (!di.UserName.IsNullOrEmpty()) node.UserName = di.UserName;
if (!di.IP.IsNullOrEmpty()) node.IP = di.IP;
if (!di.Product.IsNullOrEmpty()) node.Product = di.Product;
Expand Down
6 changes: 5 additions & 1 deletion Stardust.Server/Services/AppOnlineService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ public Node GetOrAddNode(AppInfo inf, String localIp, String ip)
if (inf != null)
{
node.Version = inf.Version;
node.MachineName = inf.MachineName;
if (!inf.MachineName.IsNullOrEmpty())
{
if (node.Name.IsNullOrEmpty() || node.Name == node.MachineName) node.Name = inf.MachineName;
node.MachineName = inf.MachineName;
}
node.UserName = inf.UserName;
}
if (node.Name.IsNullOrEmpty()) node.Name = rule.Category;
Expand Down
1 change: 0 additions & 1 deletion Stardust.Server/Services/NodeService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Xml.Linq;
using NewLife;
using NewLife.Caching;
using NewLife.Log;
Expand Down

0 comments on commit 5c98259

Please sign in to comment.