Skip to content

Commit

Permalink
lib/connections: Fully dial resumed devices (syncthing#7798)
Browse files Browse the repository at this point in the history
  • Loading branch information
imsodin authored Jul 3, 2021
1 parent 89e762f commit 1921533
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/connections/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,13 +786,23 @@ func (s *service) CommitConfiguration(from, to config.Configuration) bool {

func (s *service) checkAndSignalConnectLoopOnUpdatedDevices(from, to config.Configuration) {
oldDevices := from.DeviceMap()
dial := false
s.dialNowDevicesMut.Lock()
for _, dev := range to.Devices {
oldDev, ok := oldDevices[dev.DeviceID]
if !ok || !util.EqualStrings(oldDev.Addresses, dev.Addresses) {
s.scheduleDialNow()
break
if dev.Paused {
continue
}
if oldDev, ok := oldDevices[dev.DeviceID]; !ok || oldDev.Paused {
s.dialNowDevices[dev.DeviceID] = struct{}{}
dial = true
} else if !util.EqualStrings(oldDev.Addresses, dev.Addresses) {
dial = true
}
}
if dial {
s.scheduleDialNow()
}
s.dialNowDevicesMut.Unlock()
}

func (s *service) scheduleDialNow() {
Expand Down

0 comments on commit 1921533

Please sign in to comment.