/// <summary> /// Iterate the command pipeline. /// </summary> public int Iterate() { if (stream == null) throw new InvalidOperationException (); if (queue.Count == 0) return 0; current = queue[0]; queue.RemoveAt (0); try { current.CancellationToken.ThrowIfCancellationRequested (); } catch (OperationCanceledException) { // FIXME: is this right?? queue.RemoveAll (x => x.CancellationToken == current.CancellationToken); throw; } current.Status = ImapCommandStatus.Active; try { while (current.Step ()) { // more literal data to send... } if (current.Bye) Disconnect (); } catch { Disconnect (); throw; } return current.Id; }
/// <summary> /// Iterate the command pipeline. /// </summary> public int Iterate() { if (Stream == null) throw new InvalidOperationException (); if (queue.Count == 0) return 0; current = queue[0]; queue.RemoveAt (0); try { current.CancellationToken.ThrowIfCancellationRequested (); } catch { queue.RemoveAll (x => x.CancellationToken.IsCancellationRequested); current = null; throw; } current.Status = ImapCommandStatus.Active; int id = current.Id; try { while (current.Step ()) { // more literal data to send... } if (current.Bye) Disconnect (); } catch { Disconnect (); throw; } finally { current = null; } return id; }