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); }
internal override IList <TransportManager> SelectTransportManagers() { //test override if (peerNode == null) { PeerNodeImplementation foundPeerNode = null; // use the private InnerNode if it has been configured and matches the channel if (privatePeerNode != null && this.Uri.Host == privatePeerNode.MeshId) { foundPeerNode = privatePeerNode; this.registration = null; } else { // find or create a InnerNode for the given Uri this.registration = new PeerNodeImplementation.Registration(this.Uri, this); foundPeerNode = PeerNodeImplementation.Get(this.Uri, registration); } // ensure that the max message size is compatible if (foundPeerNode.MaxReceivedMessageSize < MaxReceivedMessageSize) { foundPeerNode.Release(); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException(SR.GetString(SR.PeerMaxReceivedMessageSizeConflict, MaxReceivedMessageSize, foundPeerNode.MaxReceivedMessageSize, this.Uri))); } // associate with the PeerNode and open it peerNode = new PeerNode(foundPeerNode); } return(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); }
public PeerInputChannel(PeerNodeImplementation peerNode, PeerNodeImplementation.Registration registration, ChannelManagerBase channelManager, EndpointAddress localAddress, Uri via) : base(channelManager, localAddress) { PeerNodeImplementation.ValidateVia(via); if (registration != null) { peerNode = PeerNodeImplementation.Get(via, registration); } this.peerNode = new PeerNode(peerNode); this.to = localAddress; this.via = via; }
public PeerOutputChannel(PeerNodeImplementation peerNode, PeerNodeImplementation.Registration registration, ChannelManagerBase channelManager, EndpointAddress localAddress, Uri via, MessageVersion messageVersion) : base(channelManager, localAddress, via, false, messageVersion) { PeerNodeImplementation.ValidateVia(via); if (registration != null) { peerNode = PeerNodeImplementation.Get(via, registration); } this.peerNode = new PeerNode(peerNode); this.via = via; this.channelManager = channelManager; this.to = localAddress; }