[#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 <carpawell@nspcc.ru>
This commit is contained in:
parent
c5fdb7bedf
commit
9e2edfedc6
2 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue