mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
Only connected devices are available devices
This commit is contained in:
parent
76900ae291
commit
fc47562983
@ -1273,6 +1273,11 @@ func (m *Model) RemoteLocalVersion(folder string) uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) availability(folder string, file string) []protocol.DeviceID {
|
func (m *Model) availability(folder string, file string) []protocol.DeviceID {
|
||||||
|
// Acquire this lock first, as the value returned from foldersFiles can
|
||||||
|
// gen heavily modified on Close()
|
||||||
|
m.pmut.RLock()
|
||||||
|
defer m.pmut.RUnlock()
|
||||||
|
|
||||||
m.fmut.RLock()
|
m.fmut.RLock()
|
||||||
fs, ok := m.folderFiles[folder]
|
fs, ok := m.folderFiles[folder]
|
||||||
m.fmut.RUnlock()
|
m.fmut.RUnlock()
|
||||||
@ -1280,7 +1285,14 @@ func (m *Model) availability(folder string, file string) []protocol.DeviceID {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return fs.Availability(file)
|
availableDevices := []protocol.DeviceID{}
|
||||||
|
for _, device := range fs.Availability(file) {
|
||||||
|
_, ok := m.protoConn[device]
|
||||||
|
if ok {
|
||||||
|
availableDevices = append(availableDevices, device)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return availableDevices
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) String() string {
|
func (m *Model) String() string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user