forked from TrueCloudLab/frostfs-node
[#1329] node: Set undefined netmap status by default
It allows general usage of `controlNetmapStatus` getter: does not matter of handler (`NewEpoch` handler of initial setter). Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
f4a3fa2977
commit
c16a31ef3e
1 changed files with 6 additions and 2 deletions
|
@ -35,8 +35,12 @@ type networkState struct {
|
|||
}
|
||||
|
||||
func newNetworkState() *networkState {
|
||||
var nmStatus atomic.Value
|
||||
nmStatus.Store(control.NetmapStatus_STATUS_UNDEFINED)
|
||||
|
||||
return &networkState{
|
||||
epoch: atomic.NewUint64(0),
|
||||
epoch: atomic.NewUint64(0),
|
||||
controlNetStatus: nmStatus,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +87,7 @@ func (s *networkState) setNodeInfo(ni *netmapSDK.NodeInfo) {
|
|||
s.controlNetStatus.Store(ctrlNetSt)
|
||||
}
|
||||
|
||||
func (s *networkState) controlNetmapStatus() control.NetmapStatus {
|
||||
func (s *networkState) controlNetmapStatus() (res control.NetmapStatus) {
|
||||
return s.controlNetStatus.Load().(control.NetmapStatus)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue