| 
														
															@@ -56,6 +56,7 @@ const ( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 type service interface { 
														 | 
														
														 | 
														
															 type service interface { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	BringToFront(string) 
														 | 
														
														 | 
														
															 	BringToFront(string) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	Override(*db.FileSet, func([]protocol.FileInfo)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	DelayScan(d time.Duration) 
														 | 
														
														 | 
														
															 	DelayScan(d time.Duration) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	IgnoresUpdated()            // ignore matcher was updated notification 
														 | 
														
														 | 
														
															 	IgnoresUpdated()            // ignore matcher was updated notification 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	SchedulePull()              // something relevant changed, we should try a pull 
														 | 
														
														 | 
														
															 	SchedulePull()              // something relevant changed, we should try a pull 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -2300,50 +2301,21 @@ func (m *Model) WatchError(folder string) error { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 func (m *Model) Override(folder string) { 
														 | 
														
														 | 
														
															 func (m *Model) Override(folder string) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	// Grab the runner and the file set. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	m.fmut.RLock() 
														 | 
														
														 | 
														
															 	m.fmut.RLock() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	fs, ok := m.folderFiles[folder] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	runner := m.folderRunners[folder] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	fs, fsOK := m.folderFiles[folder] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	runner, runnerOK := m.folderRunners[folder] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	m.fmut.RUnlock() 
														 | 
														
														 | 
														
															 	m.fmut.RUnlock() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if !ok { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	if !fsOK || !runnerOK { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		return 
														 | 
														
														 | 
														
															 		return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	} 
														 | 
														
														 | 
														
															 	} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	runner.setState(FolderScanning) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	batch := make([]protocol.FileInfo, 0, maxBatchSizeFiles) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	batchSizeBytes := 0 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	fs.WithNeed(protocol.LocalDeviceID, func(fi db.FileIntf) bool { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		need := fi.(protocol.FileInfo) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		if len(batch) == maxBatchSizeFiles || batchSizeBytes > maxBatchSizeBytes { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			m.updateLocalsFromScanning(folder, batch) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			batch = batch[:0] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			batchSizeBytes = 0 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	// Run the override, taking updates as if they came from scanning. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		have, ok := fs.Get(protocol.LocalDeviceID, need.Name) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		// Don't override invalid (e.g. ignored) files 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		if ok && have.Invalid { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			return true 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		if !ok || have.Name != need.Name { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			// We are missing the file 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			need.Deleted = true 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			need.Blocks = nil 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			need.Version = need.Version.Update(m.shortID) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			need.Size = 0 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		} else { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			// We have the file, replace with our version 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			have.Version = have.Version.Merge(need.Version).Update(m.shortID) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			need = have 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		need.Sequence = 0 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		batch = append(batch, need) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		batchSizeBytes += need.ProtoSize() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		return true 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	runner.Override(fs, func(files []protocol.FileInfo) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		m.updateLocalsFromScanning(folder, files) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	}) 
														 | 
														
														 | 
														
															 	}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if len(batch) > 0 { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		m.updateLocalsFromScanning(folder, batch) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	runner.setState(FolderIdle) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // CurrentSequence returns the change version for the given folder. 
														 | 
														
														 | 
														
															 // CurrentSequence returns the change version for the given folder. 
														 |