mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
lib/db: Defer unlock to avoid hangup on panic (#5388)
This commit is contained in:
parent
c40c9a8d6a
commit
3cc8918eb4
@ -113,6 +113,8 @@ func (m *metadataTracker) addFile(dev protocol.DeviceID, f FileIntf) {
|
||||
}
|
||||
|
||||
m.mut.Lock()
|
||||
defer m.mut.Unlock()
|
||||
|
||||
m.dirty = true
|
||||
|
||||
if flags := f.FileLocalFlags(); flags == 0 {
|
||||
@ -124,8 +126,6 @@ func (m *metadataTracker) addFile(dev protocol.DeviceID, f FileIntf) {
|
||||
m.addFileLocked(dev, flag, f)
|
||||
})
|
||||
}
|
||||
|
||||
m.mut.Unlock()
|
||||
}
|
||||
|
||||
func (m *metadataTracker) addFileLocked(dev protocol.DeviceID, flags uint32, f FileIntf) {
|
||||
@ -156,6 +156,8 @@ func (m *metadataTracker) removeFile(dev protocol.DeviceID, f FileIntf) {
|
||||
}
|
||||
|
||||
m.mut.Lock()
|
||||
defer m.mut.Unlock()
|
||||
|
||||
m.dirty = true
|
||||
|
||||
if flags := f.FileLocalFlags(); flags == 0 {
|
||||
@ -167,8 +169,6 @@ func (m *metadataTracker) removeFile(dev protocol.DeviceID, f FileIntf) {
|
||||
m.removeFileLocked(dev, flag, f)
|
||||
})
|
||||
}
|
||||
|
||||
m.mut.Unlock()
|
||||
}
|
||||
|
||||
func (m *metadataTracker) removeFileLocked(dev protocol.DeviceID, flags uint32, f FileIntf) {
|
||||
|
Loading…
Reference in New Issue
Block a user