public PeerService(PeerNodeConfig config, ChannelCallback channelCallback, GetNeighborCallback getNeighborCallback, Dictionary <Type, object> services, IPeerNodeMessageHandling messageHandler) { this.config = config; this.newChannelCallback = channelCallback; Fx.Assert(getNeighborCallback != null, "getNeighborCallback must be passed to PeerService constructor"); this.getNeighborCallback = getNeighborCallback; this.messageHandler = messageHandler; if (services != null) { object reply = null; services.TryGetValue(typeof(IPeerConnectorContract), out reply); connector = reply as IPeerConnectorContract; Fx.Assert(connector != null, "PeerService must be created with a connector implementation"); reply = null; services.TryGetValue(typeof(IPeerFlooderContract <Message, UtilityInfo>), out reply); flooder = reply as IPeerFlooderContract <Message, UtilityInfo>; Fx.Assert(flooder != null, "PeerService must be created with a flooder implementation"); } this.serviceHost = new ServiceHost(this); // Add throttling ServiceThrottlingBehavior throttle = new ServiceThrottlingBehavior(); throttle.MaxConcurrentCalls = this.config.MaxPendingIncomingCalls; throttle.MaxConcurrentSessions = this.config.MaxConcurrentSessions; this.serviceHost.Description.Behaviors.Add(throttle); }
public PeerService(PeerNodeConfig config, ChannelCallback channelCallback, GetNeighborCallback getNeighborCallback, Dictionary <Type, object> services) : this(config, channelCallback, getNeighborCallback, services, null) { }
public PeerService(PeerNodeConfig config, ChannelCallback channelCallback, GetNeighborCallback getNeighborCallback, Dictionary<System.Type, object> services, IPeerNodeMessageHandling messageHandler) { this.config = config; this.newChannelCallback = channelCallback; this.getNeighborCallback = getNeighborCallback; this.messageHandler = messageHandler; if (services != null) { object obj2 = null; services.TryGetValue(typeof(IPeerConnectorContract), out obj2); this.connector = obj2 as IPeerConnectorContract; obj2 = null; services.TryGetValue(typeof(IPeerFlooderContract<Message, UtilityInfo>), out obj2); this.flooder = obj2 as IPeerFlooderContract<Message, UtilityInfo>; } this.serviceHost = new ServiceHost(this, new Uri[0]); ServiceThrottlingBehavior item = new ServiceThrottlingBehavior { MaxConcurrentCalls = this.config.MaxPendingIncomingCalls, MaxConcurrentSessions = this.config.MaxConcurrentSessions }; this.serviceHost.Description.Behaviors.Add(item); }
public PeerService(PeerNodeConfig config, ChannelCallback channelCallback, GetNeighborCallback getNeighborCallback, Dictionary <System.Type, object> services, IPeerNodeMessageHandling messageHandler) { this.config = config; this.newChannelCallback = channelCallback; this.getNeighborCallback = getNeighborCallback; this.messageHandler = messageHandler; if (services != null) { object obj2 = null; services.TryGetValue(typeof(IPeerConnectorContract), out obj2); this.connector = obj2 as IPeerConnectorContract; obj2 = null; services.TryGetValue(typeof(IPeerFlooderContract <Message, UtilityInfo>), out obj2); this.flooder = obj2 as IPeerFlooderContract <Message, UtilityInfo>; } this.serviceHost = new ServiceHost(this, new Uri[0]); ServiceThrottlingBehavior item = new ServiceThrottlingBehavior { MaxConcurrentCalls = this.config.MaxPendingIncomingCalls, MaxConcurrentSessions = this.config.MaxConcurrentSessions }; this.serviceHost.Description.Behaviors.Add(item); }
public PeerService(PeerNodeConfig config, ChannelCallback channelCallback, GetNeighborCallback getNeighborCallback, Dictionary<System.Type, object> services) : this(config, channelCallback, getNeighborCallback, services, null) { }