настройки соединений для доунлодера
This commit is contained in:
+3
-3
@@ -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);
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user