MCPcopy
hub / github.com/syncthing/syncthing / DownloadProgress

Method DownloadProgress

lib/model/model.go:2412–2436  ·  view source on GitHub ↗
(conn protocol.Connection, p *protocol.DownloadProgress)

Source from the content-addressed store, hash-verified

2410}
2411
2412func (m *model) DownloadProgress(conn protocol.Connection, p *protocol.DownloadProgress) error {
2413 deviceID := conn.DeviceID()
2414
2415 m.mut.RLock()
2416 cfg, ok := m.folderCfgs[p.Folder]
2417 m.mut.RUnlock()
2418
2419 if !ok || !cfg.SharedWith(deviceID) {
2420 return nil
2421 }
2422
2423 m.mut.RLock()
2424 downloads := m.deviceDownloads[deviceID]
2425 m.mut.RUnlock()
2426 downloads.Update(p.Folder, p.Updates)
2427 state := downloads.GetBlockCounts(p.Folder)
2428
2429 m.evLogger.Log(events.RemoteDownloadProgress, map[string]interface{}{
2430 "device": deviceID.String(),
2431 "folder": p.Folder,
2432 "state": state,
2433 })
2434
2435 return nil
2436}
2437
2438func (m *model) deviceWasSeen(deviceID protocol.DeviceID) {
2439 m.mut.RLock()

Callers

nothing calls this directly

Calls 6

SharedWithMethod · 0.80
DeviceIDMethod · 0.65
UpdateMethod · 0.65
LogMethod · 0.65
StringMethod · 0.65
GetBlockCountsMethod · 0.45

Tested by

no test coverage detected