дебаг

This commit is contained in:
Alexey Kasyanchuk
2017-07-08 21:38:45 +03:00
parent bb89191b8e
commit 9468159885
6 changed files with 18 additions and 11 deletions

View File

@ -6,6 +6,7 @@ var net = require('net');
var PeerQueue = require('./peer-queue');
var Wire = require('./wire');
const debug = require('debug')('downloader');
class Client extends Emiter
@ -41,7 +42,7 @@ class Client extends Emiter
_download(rinfo, infohash)
{
console.log('start download ' + infohash.toString('hex'));
debug('start download ' + infohash.toString('hex'));
this.activeConnections++;
var successful = false;
@ -54,6 +55,7 @@ class Client extends Emiter
wire.on('metadata', (metadata, infoHash) => {
successful = true;
debug('successfuly downloader', infoHash, rinfo);
this.emit('complete', metadata, infoHash, rinfo);
socket.destroy();
});