Revision 4d301e8e trunk/Pithos.Core/PithosMonitor.cs

b/trunk/Pithos.Core/PithosMonitor.cs
331 331
                                      
332 332
                                      var onlyLocal = from localFile in pithosDir.EnumerateFiles()
333 333
                                                      where !remoteFiles.Contains(localFile.Name.ToLower()) 
334
                                                      select new ListenerAction(CloudActionType.UploadUnconditional, localFile,null);
334
                                                      select new ListenerAction(CloudActionType.UploadUnconditional, localFile,ObjectInfo.Empty);
335 335

  
336 336

  
337 337

  
......
340 340

  
341 341
                                      var onlyRemote = from upFile in remoteObjects
342 342
                                                       where !localNames.Contains(upFile.Name.ToLower())
343
                                                       select new ListenerAction(CloudActionType.DownloadUnconditional,null,upFile);
343
                                                       select new ListenerAction(CloudActionType.DownloadUnconditional,new FileInfo(""), upFile);
344 344

  
345 345

  
346 346
                                      var commonObjects = from  upFile in remoteObjects
......
385 385
                    switch (action.Action)
386 386
                    {
387 387
                        case CloudActionType.UploadUnconditional:
388

  
389 388
                            UploadCloudFile(localFile.Name,localFile.Length,localFile.FullName,action.LocalHash.Value);
390 389
                            break;
391 390
                        case CloudActionType.DownloadUnconditional:
......
552 551

  
553 552
        private void DownloadCloudFile(string container, string fileName, string localPath)
554 553
        {
554
            var state = StatusKeeper.GetNetworkState(fileName);
555
            //Abort if the file is already being uploaded or downloaded
556
            if (state != NetworkState.None)
557
                return;
558

  
555 559
            StatusKeeper.SetNetworkState(localPath,NetworkState.Downloading);
556 560
            CloudClient.GetObject(container, fileName, localPath)
557 561
            .ContinueWith(t=>
......
566 570
        private void UploadCloudFile(string fileName, long fileSize, string path,string hash)
567 571
        {
568 572
            Contract.Requires(!Path.IsPathRooted(fileName));
573
            var state=StatusKeeper.GetNetworkState(fileName);
574
            //Abort if the file is already being uploaded or downloaded
575
            if (state != NetworkState.None)
576
                return;
569 577

  
570 578
            StatusKeeper.SetNetworkState(fileName,NetworkState.Uploading);
571 579
            
......
584 592
                {
585 593
                    this.StatusKeeper.StoreInfo(path,info);
586 594
                }
587
            }
588
            )
595
            })
589 596
            .ContinueWith(t => 
590 597
                this.StatusKeeper.SetFileState(path, FileStatus.Unchanged, FileOverlayStatus.Normal))
591 598
                .ContinueWith(t=>

Also available in: Unified diff