mirror of
https://github.com/moby/moby.git
synced 2026-08-08 17:11:38 +00:00
Merge pull request #49985 from corhere/libn/set-primary-key-lock
libn/networkdb: SetPrimaryKey() under a write lock
This commit is contained in:
@@ -71,8 +71,8 @@ func (nDB *NetworkDB) SetKey(key []byte) {
|
||||
// been added apriori through SetKey
|
||||
func (nDB *NetworkDB) SetPrimaryKey(key []byte) {
|
||||
log.G(context.TODO()).Debugf("Primary Key %.5s", hex.EncodeToString(key))
|
||||
nDB.RLock()
|
||||
defer nDB.RUnlock()
|
||||
nDB.Lock()
|
||||
defer nDB.Unlock()
|
||||
for _, dbKey := range nDB.config.Keys {
|
||||
if bytes.Equal(key, dbKey) {
|
||||
if nDB.keyring != nil {
|
||||
|
||||
Reference in New Issue
Block a user