Revision 5e646964
b/trunk/Pithos.Core/Agents/Downloader.cs | ||
---|---|---|
54 | 54 |
{ |
55 | 55 |
// var cancellationToken=_cts.Token;// .ThrowIfCancellationRequested(); |
56 | 56 |
|
57 |
if (await WaitOrAbort(cloudFile, cancellationToken)) |
|
57 |
if (await WaitOrAbort(accountInfo,cloudFile, cancellationToken))
|
|
58 | 58 |
return; |
59 | 59 |
|
60 | 60 |
|
... | ... | |
65 | 65 |
if (cloudFile.Name.EndsWith(".ignore", StringComparison.InvariantCultureIgnoreCase)) |
66 | 66 |
return; |
67 | 67 |
|
68 |
if (!Selectives.IsSelected(cloudFile)) |
|
68 |
if (!Selectives.IsSelected(accountInfo,cloudFile))
|
|
69 | 69 |
return; |
70 | 70 |
|
71 | 71 |
|
... | ... | |
154 | 154 |
throw new ArgumentException("cloudFile is a directory, not a file", "cloudFile"); |
155 | 155 |
Contract.EndContractBlock(); |
156 | 156 |
|
157 |
if (await WaitOrAbort(cloudFile, cancellationToken)) |
|
157 |
if (await WaitOrAbort(accountInfo,cloudFile, cancellationToken))
|
|
158 | 158 |
return; |
159 | 159 |
|
160 | 160 |
var fileAgent = GetFileAgent(accountInfo); |
... | ... | |
176 | 176 |
ReportDownloadProgress(Path.GetFileName(localPath), 0, upHashes.Length, cloudFile.Bytes); |
177 | 177 |
for (var i = 0; i < upHashes.Length; i++) |
178 | 178 |
{ |
179 |
if (await WaitOrAbort(cloudFile, cancellationToken)) |
|
179 |
if (await WaitOrAbort(accountInfo,cloudFile, cancellationToken))
|
|
180 | 180 |
return; |
181 | 181 |
|
182 | 182 |
//For every non-matching hash |
... | ... | |
238 | 238 |
throw new ArgumentException("cloudFile is a directory, not a file", "cloudFile"); |
239 | 239 |
Contract.EndContractBlock(); |
240 | 240 |
|
241 |
if (await WaitOrAbort(cloudFile, cancellationToken)) |
|
241 |
if (await WaitOrAbort(accountInfo,cloudFile, cancellationToken))
|
|
242 | 242 |
return; |
243 | 243 |
|
244 | 244 |
var localPath = FileInfoExtensions.GetProperFilePathCapitalization(filePath); |
... | ... | |
327 | 327 |
return AgentLocator<FileAgent>.Get(accountInfo.AccountPath); |
328 | 328 |
} |
329 | 329 |
|
330 |
private async Task<bool> WaitOrAbort(ObjectInfo cloudFile, CancellationToken token) |
|
330 |
private async Task<bool> WaitOrAbort(AccountInfo account,ObjectInfo cloudFile, CancellationToken token)
|
|
331 | 331 |
{ |
332 | 332 |
token.ThrowIfCancellationRequested(); |
333 | 333 |
await UnpauseEvent.WaitAsync(); |
334 |
var shouldAbort = !Selectives.IsSelected(cloudFile); |
|
334 |
var shouldAbort = !Selectives.IsSelected(account,cloudFile);
|
|
335 | 335 |
if (shouldAbort) |
336 | 336 |
Log.InfoFormat("Aborting [{0}]", cloudFile.Uri); |
337 | 337 |
return shouldAbort; |
b/trunk/Pithos.Core/Agents/SelectiveUris.cs | ||
---|---|---|
61 | 61 |
SelectivePaths[account.AccountKey] = UrisToFilePaths(account,uris); |
62 | 62 |
} |
63 | 63 |
|
64 |
public bool IsSelected(ObjectInfo info) |
|
64 |
public bool IsSelected(AccountInfo account,ObjectInfo info)
|
|
65 | 65 |
{ |
66 | 66 |
//Shared folders should NOT be synced if selective syncing is disabled |
67 | 67 |
var isShared = info.IsShared??false; |
68 | 68 |
if (info.StorageUri == null) |
69 | 69 |
return true; |
70 |
var selectiveEnabled = IsSelectiveEnabled(info.AccountKey);
|
|
70 |
var selectiveEnabled = IsSelectiveEnabled(account.AccountKey);
|
|
71 | 71 |
if (!selectiveEnabled) |
72 | 72 |
return !isShared; |
73 | 73 |
|
74 | 74 |
List<Uri> filterUris; |
75 |
return !SelectiveUris.TryGetValue(info.AccountKey, out filterUris)
|
|
75 |
return !SelectiveUris.TryGetValue(account.AccountKey, out filterUris)
|
|
76 | 76 |
|| filterUris.Count ==0 |
77 | 77 |
|| filterUris.Any(f => info.Uri.IsAtOrDirectlyBelow(f)); |
78 | 78 |
} |
b/trunk/Pithos.Core/Agents/Uploader.cs | ||
---|---|---|
260 | 260 |
|
261 | 261 |
using (StatusNotification.GetNotifier("Uploading {0}", "Finished Uploading {0}", fileInfo.Name)) |
262 | 262 |
{ |
263 |
if (await WaitOrAbort(cloudFile, token)) |
|
263 |
if (await WaitOrAbort(accountInfo,cloudFile, token))
|
|
264 | 264 |
return; |
265 | 265 |
|
266 | 266 |
var fullFileName = fileInfo.GetProperCapitalization(); |
... | ... | |
278 | 278 |
while (missingHashes.Count > 0) |
279 | 279 |
{ |
280 | 280 |
|
281 |
if (await WaitOrAbort(cloudFile, token)) |
|
281 |
if (await WaitOrAbort(accountInfo,cloudFile, token))
|
|
282 | 282 |
return; |
283 | 283 |
|
284 | 284 |
|
285 | 285 |
var buffer = new byte[accountInfo.BlockSize]; |
286 | 286 |
foreach (var missingHash in missingHashes) |
287 | 287 |
{ |
288 |
if (await WaitOrAbort(cloudFile, token)) |
|
288 |
if (await WaitOrAbort(accountInfo,cloudFile, token))
|
|
289 | 289 |
return; |
290 | 290 |
|
291 | 291 |
|
... | ... | |
317 | 317 |
} |
318 | 318 |
} |
319 | 319 |
|
320 |
private async Task<bool> WaitOrAbort(ObjectInfo cloudFile, CancellationToken token) |
|
320 |
private async Task<bool> WaitOrAbort(AccountInfo account,ObjectInfo cloudFile, CancellationToken token)
|
|
321 | 321 |
{ |
322 | 322 |
token.ThrowIfCancellationRequested(); |
323 | 323 |
await UnpauseEvent.WaitAsync(); |
324 |
var shouldAbort = !Selectives.IsSelected(cloudFile); |
|
324 |
var shouldAbort = !Selectives.IsSelected(account,cloudFile);
|
|
325 | 325 |
if (shouldAbort) |
326 | 326 |
Log.InfoFormat("Aborting [{0}]",cloudFile.Uri); |
327 | 327 |
return shouldAbort; |
Also available in: Unified diff