Beispiel #1
0
        void OnChannelClosed(object sender, EventArgs args)
        {
            CustomHttpInputChannel channel = (CustomHttpInputChannel)sender;

            lock (this.currentChannelLock)
            {
                if (channel == this.currentChannel)
                {
                    this.currentChannel = null;
                }
            }
        }
Beispiel #2
0
        bool CreateOrRetrieveChannel(out CustomHttpInputChannel newChannel)
        {
            bool channelCreated = false;

            if ((newChannel = currentChannel) == null)
            {
                lock (currentChannelLock)
                {
                    if ((newChannel = currentChannel) == null)
                    {
                        newChannel         = new CustomHttpInputChannel(this);
                        newChannel.Closed += new EventHandler(this.OnChannelClosed);
                        currentChannel     = newChannel;
                        channelCreated     = true;
                    }
                }
            }

            return(channelCreated);
        }