forked from TrueCloudLab/frostfs-node
[#275] innerring: Use crypto rand shuffle in audit
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
f593f0b2d6
commit
6836975272
1 changed files with 5 additions and 3 deletions
|
@ -2,7 +2,6 @@ package audit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math/rand"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
"github.com/nspcc-dev/neofs-api-go/pkg/client"
|
||||||
|
@ -12,6 +11,7 @@ import (
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/network"
|
"github.com/nspcc-dev/neofs-node/pkg/network"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/services/audit"
|
"github.com/nspcc-dev/neofs-node/pkg/services/audit"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/storagegroup"
|
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/storagegroup"
|
||||||
|
"github.com/nspcc-dev/neofs-node/pkg/util/rand"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -66,9 +66,11 @@ func (ap *Processor) processStartAudit(epoch uint64) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// shuffle nodes to ask a random one
|
|
||||||
n := nodes.Flatten()
|
n := nodes.Flatten()
|
||||||
rand.Shuffle(len(n), func(i, j int) { // fixme: consider using crypto rand
|
crand := rand.New() // math/rand with cryptographic source
|
||||||
|
|
||||||
|
// shuffle nodes to ask a random one
|
||||||
|
crand.Shuffle(len(n), func(i, j int) {
|
||||||
n[i], n[j] = n[j], n[i]
|
n[i], n[j] = n[j], n[i]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue