настройки соединений для доунлодера

This commit is contained in:
Alexey Kasyanchuk 2017-08-25 06:46:52 +03:00
parent 2795be2e42
commit 95c11b4427
2 changed files with 8 additions and 3 deletions

View File

@ -7,14 +7,14 @@ var net = require('net');
var PeerQueue = require('./peer-queue'); var PeerQueue = require('./peer-queue');
var Wire = require('./wire'); var Wire = require('./wire');
const debug = require('debug')('downloader'); const debug = require('debug')('downloader');
const config = require('../config')
class Client extends Emiter class Client extends Emiter
{ {
constructor(options) { constructor(options) {
super(); super();
this.timeout = 5000; this.timeout = config.downloader.timeout;
this.maxConnections = 200; this.maxConnections = config.downloader.maxConnections;
this.activeConnections = 0; this.activeConnections = 0;
this.peers = new PeerQueue(this.maxConnections); this.peers = new PeerQueue(this.maxConnections);
this.on('download', this._download); this.on('download', this._download);

View File

@ -29,6 +29,11 @@ let config = {
cpuInterval: 10, cpuInterval: 10,
}, },
downloader: {
maxConnections: 2000,
timeout: 5000
}
cleanup: true, cleanup: true,
cleanupDiscLimit: 7 * 1024 * 1024 * 1024, cleanupDiscLimit: 7 * 1024 * 1024 * 1024,
spaceQuota: false, spaceQuota: false,