protected override TChannel OnCreateChannel(EndpointAddress remoteAddress, Uri via) { AmqpTransportChannel channel = new AmqpTransportChannel(this, this.channelProperties, remoteAddress, this.messageEncoderFactory.Encoder, this.maxBufferPoolSize, this.shared, this.prefetchLimit); lock (openChannels) { channel.Closed += new EventHandler(channel_Closed); openChannels.Add(channel); } return((TChannel)(object)channel); }
void channel_Closed(object sender, EventArgs e) { if (this.State != CommunicationState.Opened) { return; } lock (openChannels) { AmqpTransportChannel channel = (AmqpTransportChannel)sender; if (openChannels.Contains(channel)) { openChannels.Remove(channel); } } }
protected override IInputChannel OnAcceptChannel(TimeSpan timeout) { if (this.IsDisposed) { return(null); } if (amqpTransportChannel == null) { // TODO: add timeout processing amqpTransportChannel = new AmqpTransportChannel(this, this.channelProperties, new EndpointAddress(uri), messageEncoderFactory.Encoder, maxBufferPoolSize, this.shared, this.prefetchLimit); return((IInputChannel)(object)amqpTransportChannel); } // Singleton channel. Subsequent Accepts wait until the listener is closed acceptWaitEvent.WaitOne(); return(null); }