Exemple #1
0
        public void StartReading(TimeSpan timeout, Action connectionDequeuedCallback)
        {
            this.receiveTimeoutHelper = new TimeoutHelper(timeout);
            this.decoder = new ServerModeDecoder();
            this.ConnectionDequeuedCallback = connectionDequeuedCallback;

            bool completeSelf;

            try
            {
                completeSelf = ContinueReading();
            }
#pragma warning suppress 56500 // Microsoft, transferring exception to caller
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }

                // exception will be logged by the caller
                this.readException = e;
                completeSelf       = true;
            }

            if (completeSelf)
            {
                Complete();
            }
        }
        public void StartReading(TimeSpan receiveTimeout, Action connectionDequeuedCallback)
        {
            decoder = new ServerModeDecoder();
            receiveTimeoutHelper       = new TimeoutHelper(receiveTimeout);
            ConnectionDequeuedCallback = connectionDequeuedCallback;
            bool      completeSelf        = false;
            Exception completionException = null;

            try
            {
                completeSelf = ContinueReading();
            }
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }

                completeSelf        = true;
                completionException = e;
            }

            if (completeSelf)
            {
                Complete(completionException);
            }
        }