示例#1
0
 public PeerTransportBindingElement()
 {
     this.listenIPAddress = null;
     this.port            = 0;
     if (PeerTransportDefaults.ResolverAvailable)
     {
         this.resolver = PeerTransportDefaults.CreateResolver();
     }
     this.peerSecurity = new PeerSecuritySettings();
 }
示例#2
0
        public PeerDuplexChannel(IPeerChannelManager factory, EndpointAddress address, Uri via, PeerResolver resolver)
            : base((ChannelFactoryBase)factory, address, via)
        {
            binding       = factory.Source;
            this.resolver = factory.Resolver;
            info          = new TcpChannelInfo(binding, factory.MessageEncoder, null);     // FIXME: fill properties correctly.

            // It could be opened even with empty list of PeerNodeAddresses.
            // So, do not create PeerNode per PeerNodeAddress, but do it with PeerNodeAddress[].
            node = new PeerNodeImpl(RemoteAddress.Uri.Host, factory.Source.ListenIPAddress, factory.Source.Port);
        }
 public PeerCustomResolverBindingElement(PeerCustomResolverSettings settings)
 {
     if (settings != null)
     {
         this.address              = settings.Address;
         this.binding              = settings.Binding;
         this.resolver             = settings.Resolver;
         this.bindingConfiguration = settings.BindingConfiguration;
         this.bindingSection       = settings.BindingSection;
     }
 }
        internal PeerChannelFactory(PeerTransportBindingElement bindingElement, BindingContext context, PeerResolver peerResolver) : base(bindingElement, context)
        {
            this.listenIPAddress = bindingElement.ListenIPAddress;
            this.port            = bindingElement.Port;
            this.resolver        = peerResolver;
            this.readerQuotas    = new XmlDictionaryReaderQuotas();
            BinaryMessageEncodingBindingElement element = context.Binding.Elements.Find <BinaryMessageEncodingBindingElement>();

            if (element != null)
            {
                element.ReaderQuotas.CopyTo(this.readerQuotas);
            }
            else
            {
                EncoderDefaults.ReaderQuotas.CopyTo(this.readerQuotas);
            }
            this.securityManager      = PeerSecurityManager.Create(bindingElement.Security, context, this.readerQuotas);
            this.securityCapabilities = bindingElement.GetProperty <ISecurityCapabilities>(context);
        }
 public PeerNodeConfig(string meshId, ulong nodeId,
                       PeerResolver resolver,
                       PeerMessagePropagationFilter messagePropagationFilter,
                       MessageEncoder encoder,
                       Uri listenUri, IPAddress listenIPAddress, int port,
                       long maxReceivedMessageSize,
                       int minNeighbors, int idealNeighbors, int maxNeighbors,
                       int maxReferrals,
                       int connectTimeout,
                       int maintainerInterval,
                       PeerSecurityManager securityManager,
                       XmlDictionaryReaderQuotas readerQuotas,
                       long maxBufferPool,
                       int maxSendQueueSize,
                       int maxReceiveQueueSize)
 {
     this.connectTimeout         = connectTimeout;
     this.listenIPAddress        = listenIPAddress;
     this.listenUri              = listenUri;
     this.maxReceivedMessageSize = maxReceivedMessageSize;
     this.minNeighbors           = minNeighbors;
     this.idealNeighbors         = idealNeighbors;
     this.maxNeighbors           = maxNeighbors;
     this.maxReferrals           = maxReferrals;
     this.maxReferralCacheSize   = PeerTransportConstants.MaxReferralCacheSize;
     this.maxResolveAddresses    = PeerTransportConstants.MaxResolveAddresses;
     this.meshId  = meshId;
     this.encoder = encoder;
     this.messagePropagationFilter = messagePropagationFilter;
     this.nodeId                  = nodeId;
     this.port                    = port;
     this.resolver                = resolver;
     this.maintainerInterval      = maintainerInterval;
     this.maintainerRetryInterval = new TimeSpan(PeerTransportConstants.MaintainerRetryInterval * 10000);
     this.maintainerTimeout       = new TimeSpan(PeerTransportConstants.MaintainerTimeout * 10000);
     this.unregisterTimeout       = new TimeSpan(PeerTransportConstants.UnregisterTimeout * 10000);
     this.securityManager         = securityManager;
     readerQuotas.CopyTo(this.readerQuotas);
     this.maxBufferPoolSize          = maxBufferPool;
     this.maxIncomingConcurrentCalls = maxReceiveQueueSize;
     this.maxSendQueueSize           = maxSendQueueSize;
 }
        public override IChannelFactory <TChannel> BuildChannelFactory <TChannel>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("context"));
            }

            if (!this.CanBuildChannelFactory <TChannel>(context))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
            }

            if (this.ManualAddressing)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ManualAddressingNotSupported)));
            }

            PeerResolver peerResolver = GetResolver(context);

            return(new PeerChannelFactory <TChannel>(this, context, peerResolver));
        }
示例#7
0
        public override IChannelListener <TChannel> BuildChannelListener <TChannel>(BindingContext context) where TChannel : class, IChannel
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            PeerChannelListenerBase base2        = null;
            PeerResolver            peerResolver = this.GetResolver(context);

            if (typeof(TChannel) == typeof(IInputChannel))
            {
                base2 = new PeerInputChannelListener(this, context, peerResolver);
            }
            else
            {
                if (typeof(TChannel) != typeof(IDuplexChannel))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", System.ServiceModel.SR.GetString("ChannelTypeNotSupported", new object[] { typeof(TChannel) }));
                }
                base2 = new PeerDuplexChannelListener(this, context, peerResolver);
            }
            return((IChannelListener <TChannel>)base2);
        }
 public PeerChannelListener(PeerTransportBindingElement bindingElement, BindingContext context, PeerResolver peerResolver) : base(bindingElement, context, peerResolver)
 {
 }
示例#9
0
        public PeerOutputChannel(PeerChannelFactory <IOutputChannel> factory, EndpointAddress address, Uri via, PeerResolver resolver)
            : base(factory, address, via)
        {
            this.factory  = factory;
            this.resolver = resolver;

            // It could be opened even with empty list of PeerNodeAddresses.
            // So, do not create PeerNode per PeerNodeAddress, but do it with PeerNodeAddress[].
            node = new PeerNodeImpl(resolver, RemoteAddress, factory.Source.Port);
        }