Пример #1
0
        public void Initialize(CoordinatorCreateOptions options)
        {
            System.Net.ServicePointManager.Expect100Continue = false;
            System.Net.ServicePointManager.DefaultConnectionLimit = options.MaxWorkerCount;

            this.proxySource = new ProxyFileSource(new DefaultProxyFactory());
            var proxyWorkerFactory = (IProxyWorkerFactory)Activator.CreateInstance(options.ProxyWorkerFactoryType);
            this.swarmCoordinator = new SwarmCoordinator(proxyWorkerFactory, this.proxySource, options.MaxWorkerCount);
            this.counters = new []
            {
                new IsolatedCounter(CounterChangeInfo.SuccessesKey, this.swarmCoordinator.Status.SuccessCounter),
                new IsolatedCounter(CounterChangeInfo.FailsKey, this.swarmCoordinator.Status.FailCounter),
                new IsolatedCounter(CounterChangeInfo.ConnectionsKey, this.swarmCoordinator.Status.ConnectionCounter),
                new IsolatedCounter(CounterChangeInfo.ProxiesKey, this.swarmCoordinator.Status.ProxyCounter)
            };
        }
Пример #2
0
        public void Initialize(CoordinatorCreateOptions options)
        {
            System.Net.ServicePointManager.Expect100Continue      = false;
            System.Net.ServicePointManager.DefaultConnectionLimit = options.MaxWorkerCount;

            this.proxySource = new ProxyFileSource(new DefaultProxyFactory());
            var proxyWorkerFactory = (IProxyWorkerFactory)Activator.CreateInstance(options.ProxyWorkerFactoryType);

            this.swarmCoordinator = new SwarmCoordinator(proxyWorkerFactory, this.proxySource, options.MaxWorkerCount);
            this.counters         = new []
            {
                new IsolatedCounter(CounterChangeInfo.SuccessesKey, this.swarmCoordinator.Status.SuccessCounter),
                new IsolatedCounter(CounterChangeInfo.FailsKey, this.swarmCoordinator.Status.FailCounter),
                new IsolatedCounter(CounterChangeInfo.ConnectionsKey, this.swarmCoordinator.Status.ConnectionCounter),
                new IsolatedCounter(CounterChangeInfo.ProxiesKey, this.swarmCoordinator.Status.ProxyCounter)
            };
        }