Revision df6e9afc
b/trunk/Pithos.Core/Agents/NetworkAgent.cs | ||
---|---|---|
690 | 690 |
let localFile = FileInfoExtensions.FromPath(deleteCandidate.FilePath) |
691 | 691 |
let relativeFilePath = localFile.AsRelativeTo(accountInfo.AccountPath) |
692 | 692 |
where !cloudFiles.Any(r => r.RelativeUrlToFilePath(accountInfo.UserName) == relativeFilePath ) |
693 |
//Exclude files enqueued for uploading |
|
694 |
//Large files will not appear on the server for multiple polls. They must not be marked as deleted |
|
695 |
&& !_agent.GetEnumerable().Any(action => action.LocalFile.WithProperCapitalization().FullName == localFile.FullName) |
|
693 | 696 |
//Do NOT delete files modified since the previous poll |
694 | 697 |
&& localFile.LastAccessTime < previousPollTime |
695 | 698 |
select localFile).ToList(); |
... | ... | |
700 | 703 |
//Set the status of missing files to Conflict |
701 | 704 |
foreach (var item in filesToDelete) |
702 | 705 |
{ |
703 |
StatusKeeper.SetFileState(item.FullName, FileStatus.Conflict, FileOverlayStatus.Deleted); |
|
706 |
//Try to acquire a gate on the file, to take into account files that have been dequeued |
|
707 |
//and are being processed |
|
708 |
using (var gate = NetworkGate.Acquire(item.FullName, NetworkOperation.Deleting)) |
|
709 |
{ |
|
710 |
if (gate.Failed) |
|
711 |
continue; |
|
712 |
StatusKeeper.SetFileState(item.FullName, FileStatus.Conflict, FileOverlayStatus.Deleted); |
|
713 |
} |
|
704 | 714 |
} |
705 | 715 |
UpdateStatus(PithosStatus.HasConflicts); |
706 | 716 |
StatusNotification.NotifyConflicts(filesToDelete, String.Format("{0} local files are missing from Pithos, possibly because they were deleted",filesToDelete.Count)); |
... | ... | |
711 | 721 |
{ |
712 | 722 |
if (item.Exists) |
713 | 723 |
{ |
714 |
if ((item.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) |
|
724 |
//Try to acquire a gate on the file, to take into account files that have been dequeued |
|
725 |
//and are being processed |
|
726 |
//TODO: The gate is not enough. Perhaps we need to keep a journal of processed files and check against |
|
727 |
//that as well. |
|
728 |
using (var gate = NetworkGate.Acquire(item.FullName, NetworkOperation.Deleting)) |
|
715 | 729 |
{ |
716 |
item.Attributes = item.Attributes & ~FileAttributes.ReadOnly; |
|
730 |
if (gate.Failed) |
|
731 |
continue; |
|
732 |
if ((item.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) |
|
733 |
{ |
|
734 |
item.Attributes = item.Attributes & ~FileAttributes.ReadOnly; |
|
717 | 735 |
|
736 |
} |
|
737 |
item.Delete(); |
|
718 | 738 |
} |
719 |
item.Delete(); |
|
720 | 739 |
} |
721 | 740 |
StatusKeeper.ClearFileStatus(item.FullName); |
722 | 741 |
} |
Also available in: Unified diff