Exemplo n.º 1
0
        protected virtual void OnSubscribe(ISubscription subscription)
        {
            if (subscription == null)
            {
                throw new ArgumentException("OnSubscribe require subscription not to be null");
            }

            if (_isUpstreamCompleted)
            {
                subscription.Cancel();
            }
            else
            {
                _upstream = subscription;
                // prefetch
                _upstream.Request(_inputBuffer.Length);
                SubReceive.Become(UpstreamRunning);
            }

            Pump.GotUpstreamSubscription();
        }