mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 10:28:49 -07:00
lib/model: Missing fmut-lock on encryption failures (#7841)
This commit is contained in:
parent
dc38e6ae88
commit
eeb7091180
@ -1343,12 +1343,14 @@ func (m *model) ccHandleFolders(folders []protocol.Folder, deviceCfg config.Devi
|
|||||||
|
|
||||||
if err := m.ccCheckEncryption(cfg, folderDevice, ccDeviceInfos[folder.ID], deviceCfg.Untrusted); err != nil {
|
if err := m.ccCheckEncryption(cfg, folderDevice, ccDeviceInfos[folder.ID], deviceCfg.Untrusted); err != nil {
|
||||||
sameError := false
|
sameError := false
|
||||||
|
m.fmut.Lock()
|
||||||
if devs, ok := m.folderEncryptionFailures[folder.ID]; ok {
|
if devs, ok := m.folderEncryptionFailures[folder.ID]; ok {
|
||||||
sameError = devs[deviceID] == err
|
sameError = devs[deviceID] == err
|
||||||
} else {
|
} else {
|
||||||
m.folderEncryptionFailures[folder.ID] = make(map[protocol.DeviceID]error)
|
m.folderEncryptionFailures[folder.ID] = make(map[protocol.DeviceID]error)
|
||||||
}
|
}
|
||||||
m.folderEncryptionFailures[folder.ID][deviceID] = err
|
m.folderEncryptionFailures[folder.ID][deviceID] = err
|
||||||
|
m.fmut.Unlock()
|
||||||
msg := fmt.Sprintf("Failure checking encryption consistency with device %v for folder %v: %v", deviceID, cfg.Description(), err)
|
msg := fmt.Sprintf("Failure checking encryption consistency with device %v for folder %v: %v", deviceID, cfg.Description(), err)
|
||||||
if sameError {
|
if sameError {
|
||||||
l.Debugln(msg)
|
l.Debugln(msg)
|
||||||
@ -1361,6 +1363,7 @@ func (m *model) ccHandleFolders(folders []protocol.Folder, deviceCfg config.Devi
|
|||||||
}
|
}
|
||||||
return tempIndexFolders, paused, err
|
return tempIndexFolders, paused, err
|
||||||
}
|
}
|
||||||
|
m.fmut.Lock()
|
||||||
if devErrs, ok := m.folderEncryptionFailures[folder.ID]; ok {
|
if devErrs, ok := m.folderEncryptionFailures[folder.ID]; ok {
|
||||||
if len(devErrs) == 1 {
|
if len(devErrs) == 1 {
|
||||||
delete(m.folderEncryptionFailures, folder.ID)
|
delete(m.folderEncryptionFailures, folder.ID)
|
||||||
@ -1368,6 +1371,7 @@ func (m *model) ccHandleFolders(folders []protocol.Folder, deviceCfg config.Devi
|
|||||||
delete(m.folderEncryptionFailures[folder.ID], deviceID)
|
delete(m.folderEncryptionFailures[folder.ID], deviceID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m.fmut.Unlock()
|
||||||
|
|
||||||
// Handle indexes
|
// Handle indexes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user