remove extend.js

This commit is contained in:
Feross Aboukhadijeh 2015-01-31 15:04:16 -08:00
parent c2fb38b9e3
commit 287cd873bc
2 changed files with 10 additions and 16 deletions

View File

@ -7,7 +7,6 @@ var compact2string = require('compact2string')
var debug = require('debug')('bittorrent-tracker') var debug = require('debug')('bittorrent-tracker')
var dgram = require('dgram') var dgram = require('dgram')
var EventEmitter = require('events').EventEmitter var EventEmitter = require('events').EventEmitter
var extend = require('extend.js')
var get = require('simple-get') var get = require('simple-get')
var hat = require('hat') var hat = require('hat')
var inherits = require('inherits') var inherits = require('inherits')
@ -218,10 +217,10 @@ Tracker.prototype.destroy = function () {
*/ */
Tracker.prototype._announce = function (opts) { Tracker.prototype._announce = function (opts) {
var self = this var self = this
opts = extend({
uploaded: 0, // default, user should provide real value // defaults, user should provide real values
downloaded: 0 // default, user should provide real value if (!opts.uploaded) opts.uploaded = 0
}, opts) if (!opts.downloaded) opts.downloaded = 0
if (self.client.torrentLength != null && opts.left == null) { if (self.client.torrentLength != null && opts.left == null) {
opts.left = self.client.torrentLength - (opts.downloaded || 0) opts.left = self.client.torrentLength - (opts.downloaded || 0)
@ -262,17 +261,13 @@ Tracker.prototype._requestHttp = function (requestUrl, opts) {
var self = this var self = this
if (opts._scrape) { if (opts._scrape) {
opts = extend({ if (!opts.info_hash) opts.info_hash = self.client._infoHash.toString('binary')
info_hash: self.client._infoHash.toString('binary')
}, opts)
} else { } else {
opts = extend({ if (!opts.info_hash) opts.info_hash = self.client._infoHash.toString('binary')
info_hash: self.client._infoHash.toString('binary'), if (!opts.peer_id) opts.peer_id = self.client._peerId.toString('binary')
peer_id: self.client._peerId.toString('binary'), if (!opts.port) opts.port = self.client._port
port: self.client._port, if (!opts.compact) opts.compact = 1
compact: 1, if (!opts.numwant) opts.numwant = self.client._numWant
numwant: self.client._numWant
}, opts)
if (self._trackerId) { if (self._trackerId) {
opts.trackerid = self._trackerId opts.trackerid = self._trackerId

View File

@ -19,7 +19,6 @@
"buffer-equal": "0.0.1", "buffer-equal": "0.0.1",
"compact2string": "^1.2.0", "compact2string": "^1.2.0",
"debug": "^2.0.0", "debug": "^2.0.0",
"extend.js": "0.0.2",
"hat": "0.0.3", "hat": "0.0.3",
"inherits": "^2.0.1", "inherits": "^2.0.1",
"ip": "^0.3.0", "ip": "^0.3.0",