protected override TChannel OnCreateChannel(EndpointAddress to, Uri via) { base.ValidateScheme(via); PeerNodeImplementation peerNode = null; PeerNodeImplementation.Registration registration = null; // use the private PeerNode if it has been configured and matches the channel // otherwise have the channel look for one or create a new one if (privatePeerNode != null && via.Host == privatePeerNode.MeshId) { peerNode = privatePeerNode; } else { registration = new PeerNodeImplementation.Registration(via, this); } if (typeof(TChannel) == typeof(IOutputChannel)) { return((TChannel)(object)new PeerOutputChannel(peerNode, registration, this, to, via, this.MessageVersion)); } // typeof(TChannel) == typeof(IDuplexChannel) // 'to' is both the remote address and the local address PeerDuplexChannel duplexChannel = new PeerDuplexChannel(peerNode, registration, this, to, via); PeerMessageDispatcher <IDuplexChannel, PeerDuplexChannel> .PeerMessageQueueAdapter queueHandler = new PeerMessageDispatcher <IDuplexChannel, PeerDuplexChannel> .PeerMessageQueueAdapter(duplexChannel); PeerMessageDispatcher <IDuplexChannel, PeerDuplexChannel> dispatcher = new PeerMessageDispatcher <IDuplexChannel, PeerDuplexChannel>(queueHandler, duplexChannel.InnerNode, this, to, via); duplexChannel.Dispatcher = dispatcher; return((TChannel)(object)duplexChannel); }
protected override TChannel OnCreateChannel(EndpointAddress to, Uri via) { base.ValidateScheme(via); PeerNodeImplementation peerNode = null; PeerNodeImplementation.Registration registration = null; if ((this.privatePeerNode != null) && (via.Host == this.privatePeerNode.MeshId)) { peerNode = this.privatePeerNode; } else { registration = new PeerNodeImplementation.Registration(via, this); } if (typeof(TChannel) == typeof(IOutputChannel)) { return((TChannel) new PeerOutputChannel(peerNode, registration, this, to, via, base.MessageVersion)); } PeerDuplexChannel inputQueueChannel = new PeerDuplexChannel(peerNode, registration, this, to, via); PeerMessageDispatcher <IDuplexChannel, PeerDuplexChannel> .PeerMessageQueueAdapter queueHandler = new PeerMessageDispatcher <IDuplexChannel, PeerDuplexChannel> .PeerMessageQueueAdapter(inputQueueChannel); PeerMessageDispatcher <IDuplexChannel, PeerDuplexChannel> dispatcher = new PeerMessageDispatcher <IDuplexChannel, PeerDuplexChannel>(queueHandler, inputQueueChannel.InnerNode, this, to, via); inputQueueChannel.Dispatcher = dispatcher; return((TChannel)inputQueueChannel); }
private void CloseDispatcher() { if (this.dispatcher != null) { this.dispatcher.Unregister(true); this.dispatcher = null; } }
void CloseDispatcher() { if (dispatcher != null) { dispatcher.Unregister(true); dispatcher = null; } }
public PeerInputChannelAcceptor(PeerNodeImplementation peerNode, PeerNodeImplementation.Registration registration, ChannelManagerBase channelManager, EndpointAddress localAddress, Uri via) : base(channelManager) { this.registration = registration; this.peerNode = peerNode; this.localAddress = localAddress; this.via = via; PeerMessageDispatcher <IInputChannel, PeerInputChannel> .PeerMessageQueueAdapter queueHandler = new PeerMessageDispatcher <IInputChannel, PeerInputChannel> .PeerMessageQueueAdapter(this); this.dispatcher = new PeerMessageDispatcher <IInputChannel, PeerInputChannel>(queueHandler, peerNode, base.ChannelManager, localAddress, via); }