Ejemplo n.º 1
0
        internal ChannelHandler(MessageVersion messageVersion, IChannelBinder binder, ServiceChannel channel)
        {
            ClientRuntime clientRuntime = channel.ClientRuntime;

            this.messageVersion = messageVersion;
            this.isManualAddressing = clientRuntime.ManualAddressing;
            this.binder = binder;
            this.channel = channel;

            this.isConcurrent = true;
            this.duplexBinder = binder as DuplexChannelBinder;
            this.hasSession = binder.HasSession;
            this.isCallback = true;

            DispatchRuntime dispatchRuntime = clientRuntime.DispatchRuntime;
            if (dispatchRuntime == null)
            {
                this.receiver = new ErrorHandlingReceiver(binder, null);
            }
            else
            {
                this.receiver = new ErrorHandlingReceiver(binder, dispatchRuntime.ChannelDispatcher);
            }
            this.requestInfo = new RequestInfo(this);

        }
Ejemplo n.º 2
0
        internal ChannelHandler(MessageVersion messageVersion, IChannelBinder binder, ServiceChannel channel)
        {
            ClientRuntime clientRuntime = channel.ClientRuntime;

            _messageVersion     = messageVersion;
            _isManualAddressing = clientRuntime.ManualAddressing;
            _binder             = binder;
            _channel            = channel;

            _isConcurrent = true;
            _duplexBinder = binder as DuplexChannelBinder;
            _hasSession   = binder.HasSession;
            _isCallback   = true;

            DispatchRuntime dispatchRuntime = clientRuntime.DispatchRuntime;

            if (dispatchRuntime == null)
            {
                _receiver = new ErrorHandlingReceiver(binder, null);
            }
            else
            {
                _receiver = new ErrorHandlingReceiver(binder, dispatchRuntime.ChannelDispatcher);
            }
            _requestInfo = new RequestInfo(this);
        }
Ejemplo n.º 3
0
        public async Task <IServiceChannelDispatcher> CreateServiceChannelDispatcherAsync(IChannel channel)
        {
            var            sessionIdleManager = channel.GetProperty <ServiceChannel.SessionIdleManager>();
            IChannelBinder binder             = null;

            if (channel is IReplyChannel)
            {
                var rcbinder = channel.GetProperty <ReplyChannelBinder>();
                rcbinder.Init(channel as IReplyChannel, BaseAddress);
                binder = rcbinder;
            }
            else if (channel is IDuplexSessionChannel)
            {
                var dcbinder = channel.GetProperty <DuplexChannelBinder>();
                dcbinder.Init(channel as IDuplexSessionChannel, _requestReplyCorrelator, BaseAddress);
                binder = dcbinder;
            }
            else if (channel is IInputChannel)
            {
                var icbinder = channel.GetProperty <InputChannelBinder>();
                icbinder.Init(channel as IInputChannel, BaseAddress);
                binder = icbinder;
            }

            // TODO: Wire up wasChannelThrottled
            var channelHandler = new ChannelHandler(Binding.MessageVersion, binder, channel.GetProperty <ServiceThrottle>(),
                                                    this, /*wasChannelThrottled*/ false, sessionIdleManager);

            var channelDispatcher = channelHandler.GetDispatcher();

            channel.ChannelDispatcher = channelDispatcher;
            await channelHandler.OpenAsync();

            return(channelDispatcher);
        }
        bool TransactedAccept(out Transaction tx)
        {
            tx = null;

            try
            {
                tx = TransactionBehavior.CreateTransaction(this.ChannelDispatcher.TransactionIsolationLevel, this.ChannelDispatcher.TransactionTimeout);

                IChannelBinder binder = null;
                using (TransactionScope scope = new TransactionScope(tx))
                {
                    TimeSpan acceptTimeout = TimeoutHelper.Min(this.ChannelDispatcher.TransactionTimeout, this.ChannelDispatcher.DefaultCommunicationTimeouts.ReceiveTimeout);
                    if (!this.acceptor.TryAccept(TransactionBehavior.NormalizeTimeout(acceptTimeout), out binder))
                    {
                        return(false);
                    }
                    scope.Complete();
                }
                if (null != binder)
                {
                    this.channel     = new ListenerChannel(binder);
                    this.idleManager = SessionIdleManager.CreateIfNeeded(this.channel.Binder, this.channelDispatcher.DefaultCommunicationTimeouts.ReceiveTimeout);
                    return(true);
                }
                else
                {
                    this.AcceptedNull();
                    tx = null;
                    return(false);
                }
            }
            catch (CommunicationException e)
            {
                if (null != tx)
                {
                    try
                    {
                        tx.Rollback();
                    }
                    catch (TransactionException ex)
                    {
                        DiagnosticUtility.TraceHandledException(ex, TraceEventType.Information);
                    }
                }
                tx = null;

                DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);

                return(false);
            }
            catch (TransactionException e)
            {
                tx = null;

                DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);

                return(false);
            }
        }
Ejemplo n.º 5
0
        internal bool EndTryAccept(IAsyncResult result, out IChannelBinder channelBinder)
        {
            ErrorHandlingCompletedAsyncResult handlerResult = result as ErrorHandlingCompletedAsyncResult;

            if (handlerResult != null)
            {
                channelBinder = null;
                return(ErrorHandlingCompletedAsyncResult.End(handlerResult));
            }
            else
            {
                try
                {
                    channelBinder = this.binder.EndAccept(result);
                    if (channelBinder != null)
                    {
                        this.dispatcher.PendingChannels.Add(channelBinder.Channel);
                    }
                    return(true);
                }
                catch (CommunicationObjectAbortedException)
                {
                    channelBinder = null;
                    return(true);
                }
                catch (CommunicationObjectFaultedException)
                {
                    channelBinder = null;
                    return(true);
                }
                catch (TimeoutException)
                {
                    channelBinder = null;
                    return(false);
                }
                catch (CommunicationException e)
                {
                    this.HandleError(e);
                    channelBinder = null;
                    return(false);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    this.HandleErrorOrAbort(e);
                    channelBinder = null;
                    return(false);
                }
            }
        }
Ejemplo n.º 6
0
        public virtual ServiceChannel CreateServiceChannel(EndpointAddress address, Uri via)
        {
            IChannelBinder binder  = this.CreateInnerChannelBinder(address, via);
            ServiceChannel channel = new ServiceChannel(this, binder);

            if (binder is DuplexChannelBinder)
            {
                DuplexChannelBinder binder2 = binder as DuplexChannelBinder;
                binder2.ChannelHandler      = new ChannelHandler(this.messageVersion, binder, channel);
                binder2.DefaultCloseTimeout = this.DefaultCloseTimeout;
                binder2.DefaultSendTimeout  = this.DefaultSendTimeout;
                binder2.IdentityVerifier    = this.clientRuntime.IdentityVerifier;
            }
            return(channel);
        }
Ejemplo n.º 7
0
        internal ChannelHandler(MessageVersion messageVersion, IChannelBinder binder, ServiceThrottle throttle,
                                ServiceDispatcher serviceDispatcher, bool wasChannelThrottled, SessionIdleManager idleManager)
        {
            ChannelDispatcher channelDispatcher = serviceDispatcher.ChannelDispatcher;

            _serviceDispatcher   = serviceDispatcher;
            _messageVersion      = messageVersion;
            _isManualAddressing  = channelDispatcher.ManualAddressing;
            _binder              = binder;
            _throttle            = throttle;
            _wasChannelThrottled = wasChannelThrottled;
            _host         = channelDispatcher.Host;
            _duplexBinder = binder as DuplexChannelBinder;
            _hasSession   = binder.HasSession;
            _isConcurrent = ConcurrencyBehavior.IsConcurrent(channelDispatcher, _hasSession);

            // TODO: Work out if MultipleReceiveBinder is necessary
            //if (channelDispatcher.MaxPendingReceives > 1)
            //{
            //    // We need to preserve order if the ChannelHandler is not concurrent.
            //    this.binder = new MultipleReceiveBinder(
            //        this.binder,
            //        channelDispatcher.MaxPendingReceives,
            //        !this.isConcurrent);
            //}

            if (channelDispatcher.BufferedReceiveEnabled)
            {
                _binder = new BufferedReceiveBinder(_binder);
            }

            _idleManager = idleManager;

            if (_binder.HasSession)
            {
                _sessionOpenNotification = _binder.Channel.GetProperty <SessionOpenNotification>();
                _needToCreateSessionOpenNotificationMessage = _sessionOpenNotification != null && _sessionOpenNotification.IsEnabled;
            }

            //_requestInfo = new RequestInfo(this);

            // TODO: Wire up lifetime management in place of listener state
            //if (this.listener.State == CommunicationState.Opened)
            //{
            _serviceDispatcher.ChannelDispatcher.Channels.IncrementActivityCount();
            _incrementedActivityCountInConstructor = true;
            //}
        }
        public virtual ServiceChannel CreateServiceChannel(EndpointAddress address, Uri via)
        {
            IChannelBinder binder         = CreateInnerChannelBinder(address, via);
            ServiceChannel serviceChannel = new ServiceChannel(this, binder);

            if (binder is DuplexChannelBinder)
            {
                DuplexChannelBinder duplexChannelBinder = binder as DuplexChannelBinder;
                duplexChannelBinder.ChannelHandler      = new ChannelHandler(MessageVersion, binder, serviceChannel);
                duplexChannelBinder.DefaultCloseTimeout = DefaultCloseTimeout;
                duplexChannelBinder.DefaultSendTimeout  = DefaultSendTimeout;
                duplexChannelBinder.IdentityVerifier    = _clientRuntime.IdentityVerifier;
            }

            return(serviceChannel);
        }
 internal ChannelHandler(ChannelHandler handler, TransactedBatchContext context)
 {
     this.messageVersion = handler.messageVersion;
     this.isManualAddressing = handler.isManualAddressing;
     this.binder = handler.binder;
     this.listener = handler.listener;
     this.wasChannelThrottled = handler.wasChannelThrottled;
     this.host = handler.host;
     this.receiveSynchronously = true;
     this.receiveWithTransaction = true;
     this.duplexBinder = handler.duplexBinder;
     this.hasSession = handler.hasSession;
     this.isConcurrent = handler.isConcurrent;
     this.receiver = handler.receiver;
     this.sharedTransactedBatchContext = context.Shared;
     this.transactedBatchContext = context;
     this.requestInfo = new RequestInfo(this);
 }
 internal bool TryAccept(TimeSpan timeout, out IChannelBinder channelBinder)
 {
     try
     {
         channelBinder = this.binder.Accept(timeout);
         if (channelBinder != null)
         {
             this.dispatcher.PendingChannels.Add(channelBinder.Channel);
         }
         return(true);
     }
     catch (CommunicationObjectAbortedException)
     {
         channelBinder = null;
         return(true);
     }
     catch (CommunicationObjectFaultedException)
     {
         channelBinder = null;
         return(true);
     }
     catch (TimeoutException)
     {
         channelBinder = null;
         return(false);
     }
     catch (CommunicationException exception)
     {
         this.HandleError(exception);
         channelBinder = null;
         return(false);
     }
     catch (Exception exception2)
     {
         if (Fx.IsFatal(exception2))
         {
             throw;
         }
         this.HandleErrorOrAbort(exception2);
         channelBinder = null;
         return(false);
     }
 }
Ejemplo n.º 11
0
        internal ChannelHandler(MessageVersion messageVersion, IChannelBinder binder,
                                ListenerHandler listener, SessionIdleManager idleManager)
        {
            ChannelDispatcher channelDispatcher = listener.ChannelDispatcher;

            _messageVersion     = messageVersion;
            _isManualAddressing = channelDispatcher.ManualAddressing;
            _binder             = binder;
            _listener           = listener;

            _receiveSynchronously = channelDispatcher.ReceiveSynchronously;
            _sendAsynchronously   = channelDispatcher.SendAsynchronously;
            _duplexBinder         = binder as DuplexChannelBinder;
            _hasSession           = binder.HasSession;
            _isConcurrent         = ConcurrencyBehavior.IsConcurrent(channelDispatcher, _hasSession);

            if (channelDispatcher.MaxPendingReceives > 1)
            {
                throw NotImplemented.ByDesign;
            }

            if (channelDispatcher.BufferedReceiveEnabled)
            {
                _binder = new BufferedReceiveBinder(_binder);
            }

            _receiver    = new ErrorHandlingReceiver(_binder, channelDispatcher);
            _idleManager = idleManager;
            Fx.Assert((_idleManager != null) == (_binder.HasSession && _listener.ChannelDispatcher.DefaultCommunicationTimeouts.ReceiveTimeout != TimeSpan.MaxValue), "idle manager is present only when there is a session with a finite receive timeout");


            _requestInfo = new RequestInfo(this);

            if (_listener.State == CommunicationState.Opened)
            {
                _listener.ChannelDispatcher.Channels.IncrementActivityCount();
                _incrementedActivityCountInConstructor = true;
            }
        }
Ejemplo n.º 12
0
        internal ChannelHandler(MessageVersion messageVersion, IChannelBinder binder,
            ListenerHandler listener, SessionIdleManager idleManager)
        {
            ChannelDispatcher channelDispatcher = listener.ChannelDispatcher;

            _messageVersion = messageVersion;
            _isManualAddressing = channelDispatcher.ManualAddressing;
            _binder = binder;
            _listener = listener;

            _receiveSynchronously = channelDispatcher.ReceiveSynchronously;
            _sendAsynchronously = channelDispatcher.SendAsynchronously;
            _duplexBinder = binder as DuplexChannelBinder;
            _hasSession = binder.HasSession;
            _isConcurrent = ConcurrencyBehavior.IsConcurrent(channelDispatcher, _hasSession);

            if (channelDispatcher.MaxPendingReceives > 1)
            {
                throw NotImplemented.ByDesign;
            }

            if (channelDispatcher.BufferedReceiveEnabled)
            {
                _binder = new BufferedReceiveBinder(_binder);
            }

            _receiver = new ErrorHandlingReceiver(_binder, channelDispatcher);
            _idleManager = idleManager;
            Fx.Assert((_idleManager != null) == (_binder.HasSession && _listener.ChannelDispatcher.DefaultCommunicationTimeouts.ReceiveTimeout != TimeSpan.MaxValue), "idle manager is present only when there is a session with a finite receive timeout");

            _requestInfo = new RequestInfo(this);

            if (_listener.State == CommunicationState.Opened)
            {
                _listener.ChannelDispatcher.Channels.IncrementActivityCount();
                _incrementedActivityCountInConstructor = true;
            }
        }
 public ListenerChannel(IChannelBinder binder)
 {
     this.binder = binder;
 }
Ejemplo n.º 14
0
 public ListenerChannel(IChannelBinder binder)
 {
     _binder = binder;
 }
Ejemplo n.º 15
0
        internal ChannelHandler(MessageVersion messageVersion, IChannelBinder binder, ServiceThrottle throttle,
            ListenerHandler listener, bool wasChannelThrottled, WrappedTransaction acceptTransaction, SessionIdleManager idleManager)
        {
            ChannelDispatcher channelDispatcher = listener.ChannelDispatcher;

            this.messageVersion = messageVersion;
            this.isManualAddressing = channelDispatcher.ManualAddressing;
            this.binder = binder;
            this.throttle = throttle;
            this.listener = listener;
            this.wasChannelThrottled = wasChannelThrottled;

            this.host = listener.Host;
            this.receiveSynchronously = channelDispatcher.ReceiveSynchronously;
            this.sendAsynchronously = channelDispatcher.SendAsynchronously;
            this.duplexBinder = binder as DuplexChannelBinder;
            this.hasSession = binder.HasSession;
            this.isConcurrent = ConcurrencyBehavior.IsConcurrent(channelDispatcher, this.hasSession);

            if (channelDispatcher.MaxPendingReceives > 1)
            {
                // We need to preserve order if the ChannelHandler is not concurrent.
                this.binder = new MultipleReceiveBinder(
                    this.binder,
                    channelDispatcher.MaxPendingReceives,
                    !this.isConcurrent);
            }

            if (channelDispatcher.BufferedReceiveEnabled)
            {
                this.binder = new BufferedReceiveBinder(this.binder);
            }

            this.receiver = new ErrorHandlingReceiver(this.binder, channelDispatcher);
            this.idleManager = idleManager;
            Fx.Assert((this.idleManager != null) == (this.binder.HasSession && this.listener.ChannelDispatcher.DefaultCommunicationTimeouts.ReceiveTimeout != TimeSpan.MaxValue), "idle manager is present only when there is a session with a finite receive timeout");

            if (channelDispatcher.IsTransactedReceive && !channelDispatcher.ReceiveContextEnabled)
            {
                receiveSynchronously = true;
                receiveWithTransaction = true;

                if (channelDispatcher.MaxTransactedBatchSize > 0)
                {
                    int maxConcurrentBatches = 1;
                    if (null != throttle && throttle.MaxConcurrentCalls > 1)
                    {
                        maxConcurrentBatches = throttle.MaxConcurrentCalls;
                        foreach (EndpointDispatcher endpointDispatcher in channelDispatcher.Endpoints)
                        {
                            if (ConcurrencyMode.Multiple != endpointDispatcher.DispatchRuntime.ConcurrencyMode)
                            {
                                maxConcurrentBatches = 1;
                                break;
                            }
                        }
                    }

                    this.sharedTransactedBatchContext = new SharedTransactedBatchContext(this, channelDispatcher, maxConcurrentBatches);
                    this.isMainTransactedBatchHandler = true;
                    this.throttle = null;
                }
            }
            else if (channelDispatcher.IsTransactedReceive && channelDispatcher.ReceiveContextEnabled && channelDispatcher.MaxTransactedBatchSize > 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.IncompatibleBehaviors)));
            }

            if (this.binder.HasSession)
            {
                this.sessionOpenNotification = this.binder.Channel.GetProperty<SessionOpenNotification>();
                this.needToCreateSessionOpenNotificationMessage = this.sessionOpenNotification != null && this.sessionOpenNotification.IsEnabled;
            }

            this.acceptTransaction = acceptTransaction;
            this.requestInfo = new RequestInfo(this);

            if (this.listener.State == CommunicationState.Opened)
            {
                this.listener.ChannelDispatcher.Channels.IncrementActivityCount();
                this.incrementedActivityCountInConstructor = true;
            }
        }
 internal ChannelHandler(MessageVersion messageVersion, IChannelBinder binder, ServiceThrottle throttle, ListenerHandler listener, bool wasChannelThrottled, WrappedTransaction acceptTransaction, ServiceChannel.SessionIdleManager idleManager)
 {
     ChannelDispatcher channelDispatcher = listener.ChannelDispatcher;
     this.messageVersion = messageVersion;
     this.isManualAddressing = channelDispatcher.ManualAddressing;
     this.binder = binder;
     this.throttle = throttle;
     this.listener = listener;
     this.wasChannelThrottled = wasChannelThrottled;
     this.host = listener.Host;
     this.receiveSynchronously = channelDispatcher.ReceiveSynchronously;
     this.duplexBinder = binder as DuplexChannelBinder;
     this.hasSession = binder.HasSession;
     this.isConcurrent = ConcurrencyBehavior.IsConcurrent(channelDispatcher, this.hasSession);
     if (channelDispatcher.MaxPendingReceives > 1)
     {
         this.binder = new MultipleReceiveBinder(this.binder, channelDispatcher.MaxPendingReceives, !this.isConcurrent);
     }
     if (channelDispatcher.BufferedReceiveEnabled)
     {
         this.binder = new BufferedReceiveBinder(this.binder);
     }
     this.receiver = new ErrorHandlingReceiver(this.binder, channelDispatcher);
     this.idleManager = idleManager;
     if (!channelDispatcher.IsTransactedReceive || channelDispatcher.ReceiveContextEnabled)
     {
         if ((channelDispatcher.IsTransactedReceive && channelDispatcher.ReceiveContextEnabled) && (channelDispatcher.MaxTransactedBatchSize > 0))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("IncompatibleBehaviors")));
         }
     }
     else
     {
         this.receiveSynchronously = true;
         this.receiveWithTransaction = true;
         if (channelDispatcher.MaxTransactedBatchSize > 0)
         {
             int maxConcurrentBatches = 1;
             if ((throttle != null) && (throttle.MaxConcurrentCalls > 1))
             {
                 maxConcurrentBatches = throttle.MaxConcurrentCalls;
                 foreach (EndpointDispatcher dispatcher2 in channelDispatcher.Endpoints)
                 {
                     if (ConcurrencyMode.Multiple != dispatcher2.DispatchRuntime.ConcurrencyMode)
                     {
                         maxConcurrentBatches = 1;
                         break;
                     }
                 }
             }
             this.sharedTransactedBatchContext = new SharedTransactedBatchContext(this, channelDispatcher, maxConcurrentBatches);
             this.isMainTransactedBatchHandler = true;
             this.throttle = null;
         }
     }
     this.acceptTransaction = acceptTransaction;
     this.requestInfo = new RequestInfo(this);
     if (!this.hasSession && (this.listener.State == CommunicationState.Opened))
     {
         this.listener.ChannelDispatcher.Channels.IncrementActivityCount();
         this.incrementedActivityCountInConstructor = true;
     }
 }
Ejemplo n.º 17
0
        internal ChannelHandler(ChannelHandler handler, TransactedBatchContext context)
        {
            this.messageVersion = handler.messageVersion;
            this.isManualAddressing = handler.isManualAddressing;
            this.binder = handler.binder;
            this.listener = handler.listener;
            this.wasChannelThrottled = handler.wasChannelThrottled;

            this.host = handler.host;
            this.receiveSynchronously = true;
            this.receiveWithTransaction = true;
            this.duplexBinder = handler.duplexBinder;
            this.hasSession = handler.hasSession;
            this.isConcurrent = handler.isConcurrent;
            this.receiver = handler.receiver;

            this.sharedTransactedBatchContext = context.Shared;
            this.transactedBatchContext = context;
            this.requestInfo = new RequestInfo(this);

            this.sendAsynchronously = handler.sendAsynchronously;
            this.sessionOpenNotification = handler.sessionOpenNotification;
            this.needToCreateSessionOpenNotificationMessage = handler.needToCreateSessionOpenNotificationMessage;
            this.shouldRejectMessageWithOnOpenActionHeader = handler.shouldRejectMessageWithOnOpenActionHeader;
        }
Ejemplo n.º 18
0
 public ListenerChannel(IChannelBinder binder)
 {
     _binder = binder;
 }
 public BufferedReceiveBinder(IChannelBinder channelBinder)
 {
     _channelBinder = channelBinder;
     _inputQueue = new InputQueue<RequestContextWrapper>();
 }
Ejemplo n.º 20
0
        private Task DispatchAsyncCore(RequestContext request, IChannel channel, EndpointDispatcher endpointDispatcher, CancellationToken token)
        {
            var dispatchRuntime = endpointDispatcher.DispatchRuntime;
            //EndpointDispatcher endpoint = dispatchRuntime.EndpointDispatcher;
            //bool releasedPump = false;

            ServiceChannel serviceChannel     = null;
            var            sessionIdleManager = channel.GetProperty <ServiceChannel.SessionIdleManager>();
            IChannelBinder binder             = null;

            if (channel is IReplyChannel)
            {
                var rcbinder = channel.GetProperty <ReplyChannelBinder>();
                rcbinder.Init(channel as IReplyChannel, BaseAddress);
                binder = rcbinder;
            }
            else if (channel is IDuplexSessionChannel)
            {
                var dcbinder = channel.GetProperty <DuplexChannelBinder>();
                dcbinder.Init(channel as IDuplexSessionChannel, _requestReplyCorrelator, BaseAddress);
                binder = dcbinder;
            }

            serviceChannel = new ServiceChannel(
                binder,
                endpointDispatcher,
                Binding,
                sessionIdleManager.UseIfNeeded(binder, Binding.ReceiveTimeout));

            Message message = request.RequestMessage;
            DispatchOperationRuntime operation = dispatchRuntime.GetOperation(ref message);

            if (operation == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "No DispatchOperationRuntime found to process message.")));
            }

            // TODO: Wire in session open notification
            //if (shouldRejectMessageWithOnOpenActionHeader && message.Headers.Action == OperationDescription.SessionOpenedAction)
            //{
            //    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.SFxNoEndpointMatchingAddressForConnectionOpeningMessage, message.Headers.Action, "Open")));
            //}

            // TODO: Session lifetime
            //if (operation.IsTerminating && requestInfo.HasSession)
            //{
            //    isChannelTerminated = true;
            //}

            // TODO: Fix up whatever semantics OperationContext places on a host being passed
            var currentOperationContext = new OperationContext(request, message, serviceChannel, /*host*/ null);

            currentOperationContext.EndpointDispatcher = endpointDispatcher;

            var existingInstanceContext = dispatchRuntime.InstanceContextProvider.GetExistingInstanceContext(request.RequestMessage, serviceChannel.Proxy as IContextChannel);
            // TODO: Investigate consequences of cleanThread parameter
            MessageRpc rpc = new MessageRpc(request, message, operation, serviceChannel, /*host*/ null,
                                            /*cleanThread*/ true, currentOperationContext, existingInstanceContext /*, eventTraceActivity*/);

            return(operation.Parent.DispatchAsync(ref rpc, /*hasOperationContextBeenSet*/ false));
            // TODO : Fix error handling
            //catch (Exception e)
            //{
            //    if (Fx.IsFatal(e))
            //    {
            //        throw;
            //    }
            //    return HandleError(e, request, channel);
            //}
        }
Ejemplo n.º 21
0
 public BufferedReceiveBinder(IChannelBinder channelBinder)
 {
     this.channelBinder = channelBinder;
     this.inputQueue    = new InputQueue <RequestContextWrapper>();
 }
Ejemplo n.º 22
0
 public MultipleReceiveBinder(IChannelBinder channelBinder, int size, bool ordered)
 {
     this.ordered        = ordered;
     this.channelBinder  = channelBinder;
     this.pendingResults = new ReceiveScopeQueue(size);
 }
 public ListenerChannel(IChannelBinder binder)
 {
     this.binder = binder;
 }
Ejemplo n.º 24
0
 internal ErrorHandlingReceiver(IChannelBinder binder, ChannelDispatcher dispatcher)
 {
     _binder     = binder;
     _dispatcher = dispatcher;
 }
Ejemplo n.º 25
0
 public MultipleReceiveBinder(IChannelBinder channelBinder, int size, bool ordered)
 {
     this.ordered       = ordered;
     this.channelBinder = channelBinder;
 }