Example #1
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);
        }
Example #2
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;
            }
        }