新增节点下线更新函数,节点断联后提交节点状态更新;重命名边缘节点相关函数以提高可读性;调整节点更新通知通道大小
This commit is contained in:
@@ -87,9 +87,9 @@ func processCtrlConn(_ctx context.Context, conn net.Conn) (err error) {
|
||||
// 结束时清理
|
||||
var edgeId int32
|
||||
defer func() {
|
||||
var edge, ok = app.Edges.Load(edgeId)
|
||||
if ok {
|
||||
*edge.Status = 0
|
||||
err := app.OfflineEdge(edgeId)
|
||||
if err != nil {
|
||||
slog.Error("管理节点下线失败", "err", err)
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -193,7 +193,7 @@ func onOpen(ctx context.Context, writer io.Writer, edgeId int32, addr net.Addr)
|
||||
return errors.New("没有可用的端口")
|
||||
}
|
||||
|
||||
err := app.NewEdge(edgeId, port, tcpAddr)
|
||||
err := app.OnlineEdgeNew(edgeId, port, tcpAddr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("新增边缘节点失败:%w", err)
|
||||
}
|
||||
@@ -202,7 +202,7 @@ func onOpen(ctx context.Context, writer io.Writer, edgeId int32, addr net.Addr)
|
||||
} else {
|
||||
// 更新边缘节点地址
|
||||
port = *edge.Port
|
||||
err := app.TryUpdateEdge(edgeId, tcpAddr)
|
||||
err := app.OnlineEdgeUpdate(edgeId, tcpAddr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("尝试更新边缘节点失败: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user