mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 12:11:36 +00:00
do not filter out extra keys from 'update' events
This commit is contained in:
parent
8482c3af0a
commit
f65983e466
@ -190,11 +190,11 @@ HTTPTracker.prototype._onAnnounceResponse = function (data) {
|
||||
self._trackerId = trackerId
|
||||
}
|
||||
|
||||
self.client.emit('update', {
|
||||
var response = Object.assign({}, data, {
|
||||
announce: self.announceUrl,
|
||||
complete: data.complete,
|
||||
incomplete: data.incomplete
|
||||
infoHash: common.binaryToHex(data.info_hash)
|
||||
})
|
||||
self.client.emit('update', response)
|
||||
|
||||
var addrs
|
||||
if (Buffer.isBuffer(data.peers)) {
|
||||
@ -248,15 +248,12 @@ HTTPTracker.prototype._onScrapeResponse = function (data) {
|
||||
}
|
||||
|
||||
keys.forEach(function (infoHash) {
|
||||
var response = data[infoHash]
|
||||
// TODO: optionally handle data.flags.min_request_interval
|
||||
// (separate from announce interval)
|
||||
self.client.emit('scrape', {
|
||||
var response = Object.assign(data[infoHash], {
|
||||
announce: self.announceUrl,
|
||||
infoHash: common.binaryToHex(infoHash),
|
||||
complete: response.complete,
|
||||
incomplete: response.incomplete,
|
||||
downloaded: response.downloaded
|
||||
infoHash: common.binaryToHex(infoHash)
|
||||
})
|
||||
self.client.emit('scrape', response)
|
||||
})
|
||||
}
|
||||
|
@ -266,8 +266,11 @@ WebSocketTracker.prototype._onAnnounceResponse = function (data) {
|
||||
}
|
||||
|
||||
if (data.complete != null) {
|
||||
data.announce = self.announceUrl
|
||||
self.client.emit('update', data)
|
||||
var response = Object.assign({}, data, {
|
||||
announce: self.announceUrl,
|
||||
infoHash: common.binaryToHex(data.info_hash)
|
||||
})
|
||||
self.client.emit('update', response)
|
||||
}
|
||||
|
||||
var peer
|
||||
@ -323,16 +326,13 @@ WebSocketTracker.prototype._onScrapeResponse = function (data) {
|
||||
}
|
||||
|
||||
keys.forEach(function (infoHash) {
|
||||
var response = data[infoHash]
|
||||
// TODO: optionally handle data.flags.min_request_interval
|
||||
// (separate from announce interval)
|
||||
self.client.emit('scrape', {
|
||||
var response = Object.assign(data[infoHash], {
|
||||
announce: self.announceUrl,
|
||||
infoHash: common.binaryToHex(infoHash),
|
||||
complete: response.complete,
|
||||
incomplete: response.incomplete,
|
||||
downloaded: response.downloaded
|
||||
infoHash: common.binaryToHex(infoHash)
|
||||
})
|
||||
self.client.emit('scrape', response)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user