public IDisposable Subscribe(IObserver <T> observer) { if (maxConcurrency == int.MaxValue) { var parent = new MaybeConcatEagerAllCoordinator <T>(observer, delayErrors); foreach (var src in sources) { if (!parent.SubscribeTo(src)) { break; } } parent.Done(); return(parent); } else { var parent = new ConcatEagerLimitedCoordinator(observer, sources, maxConcurrency, delayErrors); parent.Drain(); return(parent); } }
public IDisposable Subscribe(IObserver <T> observer) { var en = default(IEnumerator <IMaybeSource <T> >); try { en = RequireNonNullRef(sources.GetEnumerator(), "The GetEnumerator returned a null IEnumerator"); } catch (Exception ex) { observer.OnError(ex); return(DisposableHelper.EMPTY); } if (maxConcurrency == int.MaxValue) { var parent = new MaybeConcatEagerAllCoordinator <T>(observer, delayErrors); for (; ;) { var b = false; var src = default(IMaybeSource <T>); try { b = en.MoveNext(); if (!b) { break; } src = en.Current; } catch (Exception ex) { parent.SubscribeTo(MaybeSource.Error <T>(ex)); break; } if (!parent.SubscribeTo(src)) { break; } } en.Dispose(); parent.Done(); return(parent); } else { var parent = new ConcatEagerLimitedCoordinator(observer, en, maxConcurrency, delayErrors); parent.Drain(); return(parent); } }