From 9e2edfedc699eff0fd9871545488a7cd3a09b8a7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 10 Oct 2022 23:04:00 +0300 Subject: [PATCH] [#1833] node: Update local node info on nil updates If the contract returns a netmap that does not contain the node, update local `NodeInfo`. It fixes `neofs-cli netmap nodeinfo` command that printed "state: online" previously. Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + cmd/neofs-node/netmap.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 990489f9a..a92353061 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Changelog for NeoFS Node - Correlation of object session to request (#1420) - Do not increase error counter in `engine.Inhume` if shard is read-only (#1839) - `control drop-objects` can remove split objects (#1830) +- Node's status in `neofs-cli netmap nodeinfo` command (#1833) ### Removed - Remove WIF and NEP2 support in `neofs-cli`'s --wallet flag (#1128) diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 1af15956b..84250e97e 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -65,6 +65,17 @@ func (s *networkState) setNodeInfo(ni *netmapSDK.NodeInfo) { } } else { ctrlNetSt = control.NetmapStatus_OFFLINE + + niRaw := s.nodeInfo.Load() + if niRaw != nil { + niOld := niRaw.(netmapSDK.NodeInfo) + + // nil ni means that the node is not included + // in the netmap + niOld.SetOffline() + + s.nodeInfo.Store(niOld) + } } s.controlNetStatus.Store(ctrlNetSt)