Revision 38ac43a6 trunk/Pithos.Core/Agents/NetworkAgent.cs

b/trunk/Pithos.Core/Agents/NetworkAgent.cs
83 83
        [System.ComponentModel.Composition.Import]
84 84
        public IPithosSettings Settings { get; set; }
85 85

  
86
        //The Pause event stops the poll agent to give priority to the network agent
86
        //The Proceed signals the poll agent that it can proceed with polling. 
87
        //Essentially it stops the poll agent to give priority to the network agent
87 88
        //Initially the event is signalled because we don't need to pause
88
        private readonly AsyncManualResetEvent _pauseEvent = new AsyncManualResetEvent(true);
89
        private readonly AsyncManualResetEvent _proceedEvent = new AsyncManualResetEvent(true);
89 90

  
90
        public AsyncManualResetEvent PauseEvent
91
        public AsyncManualResetEvent ProceedEvent
91 92
        {
92
            get { return _pauseEvent; }
93
            get { return _proceedEvent; }
93 94
        }
94 95

  
95 96

  
......
100 101
                Action loop = null;
101 102
                loop = () =>
102 103
                {
103
                    _deleteAgent.PauseEvent.Wait();
104
                    _deleteAgent.ProceedEvent.Wait();
104 105
                    var message = inbox.Receive();
105 106
                    var process=message.Then(Process,inbox.CancellationToken);
106 107
                    inbox.LoopAsync(process, loop);
......
130 131

  
131 132
                try
132 133
                {
133
                    _pauseEvent.Reset();
134
                    _proceedEvent.Reset();
134 135
                    UpdateStatus(PithosStatus.Syncing);
135 136
                    var accountInfo = action.AccountInfo;
136 137

  
......
207 208
                finally
208 209
                {
209 210
                    if (_agent.IsEmpty)
210
                        _pauseEvent.Set();
211
                        _proceedEvent.Set();
211 212
                    UpdateStatus(PithosStatus.InSynch);                                        
212 213
                }
213 214
            }
......
314 315
                throw new ArgumentException("The CloudAction.AccountInfo is empty","cloudAction");
315 316
            Contract.EndContractBlock();
316 317

  
317
            _deleteAgent.PauseEvent.Wait();
318
            _deleteAgent.ProceedEvent.Wait();
318 319

  
319 320
            //If the action targets a local file, add a treehash calculation
320 321
            if (!(cloudAction is CloudDeleteAction) && cloudAction.LocalFile as FileInfo != null)
......
352 353

  
353 354
        public Task GetDeleteAwaiter()
354 355
        {
355
            return _deleteAgent.PauseEvent.WaitAsync();
356
            return _deleteAgent.ProceedEvent.WaitAsync();
356 357
        }
357 358
        public CancellationToken CancellationToken
358 359
        {

Also available in: Unified diff