博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

WC框架

Posted on 2012-09-18 12:40  qianyz  阅读(154)  评论(0编辑  收藏  举报

ChannelDispatcher 字段

public class ChannelDispatcher : ChannelDispatcherBase
{
    // Fields
    private ThreadSafeMessageFilterTable<EndpointAddress> addressTable;
    private string bindingName;
    private SynchronizedCollection<IChannelInitializer> channelInitializers;//通道初始化器
    private CommunicationObjectManager<IChannel> channels;//通道管理器
    private EndpointDispatcherCollection endpointDispatchers;
    private ErrorBehavior errorBehavior;
    private Collection<IErrorHandler> errorHandlers;//错误处理器
    private EndpointDispatcherTable filterTable;
    private ServiceHostBase host;
    private bool includeExceptionDetailInFaults;
    private bool isTransactedReceive;
    private readonly IChannelListener listener;
    private ListenerHandler listenerHandler;//
    private int maxPendingReceives;
    private int maxTransactedBatchSize;
    private MessageVersion messageVersion;
    private SynchronizedChannelCollection<IChannel> pendingChannels;
    private bool performDefaultCloseInput;
    private bool receiveContextEnabled;
    private bool receiveSynchronously;
    private bool sendAsynchronously;
    private ServiceThrottle serviceThrottle;
    private bool session;
    private SharedRuntimeState shared;
    private IDefaultCommunicationTimeouts timeouts;
    private IsolationLevel transactionIsolationLevel;
    private bool transactionIsolationLevelSet;
    private TimeSpan transactionTimeout;

}

 

 

ChannelHandle:

private void HandleReceiveComplete(RequestContext context)
{
    if ((context == null) && this.incrementedActivityCountInConstructor)
    {
        this.listener.ChannelDispatcher.Channels.DecrementActivityCount();
    }
    if (this.channel != null)
    {
        this.channel.HandleReceiveComplete(context);
    }
    else if ((context == null) && this.hasSession)
    {
        bool flag;
        lock (this.ThisLock)
        {
            flag = !this.doneReceiving;
            this.doneReceiving = true;
        }
        if (flag)
        {
            this.receiver.Close();
            if (this.idleManager != null)
            {
                this.idleManager.CancelTimer();
            }
            ServiceThrottle throttle = this.throttle;
            if (throttle != null)
            {
                throttle.DeactivateChannel();
            }
        }
    }
}