mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 20:21: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._trackerId = trackerId
|
||||||
}
|
}
|
||||||
|
|
||||||
self.client.emit('update', {
|
var response = Object.assign({}, data, {
|
||||||
announce: self.announceUrl,
|
announce: self.announceUrl,
|
||||||
complete: data.complete,
|
infoHash: common.binaryToHex(data.info_hash)
|
||||||
incomplete: data.incomplete
|
|
||||||
})
|
})
|
||||||
|
self.client.emit('update', response)
|
||||||
|
|
||||||
var addrs
|
var addrs
|
||||||
if (Buffer.isBuffer(data.peers)) {
|
if (Buffer.isBuffer(data.peers)) {
|
||||||
@ -248,15 +248,12 @@ HTTPTracker.prototype._onScrapeResponse = function (data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
keys.forEach(function (infoHash) {
|
keys.forEach(function (infoHash) {
|
||||||
var response = data[infoHash]
|
|
||||||
// TODO: optionally handle data.flags.min_request_interval
|
// TODO: optionally handle data.flags.min_request_interval
|
||||||
// (separate from announce interval)
|
// (separate from announce interval)
|
||||||
self.client.emit('scrape', {
|
var response = Object.assign(data[infoHash], {
|
||||||
announce: self.announceUrl,
|
announce: self.announceUrl,
|
||||||
infoHash: common.binaryToHex(infoHash),
|
infoHash: common.binaryToHex(infoHash)
|
||||||
complete: response.complete,
|
|
||||||
incomplete: response.incomplete,
|
|
||||||
downloaded: response.downloaded
|
|
||||||
})
|
})
|
||||||
|
self.client.emit('scrape', response)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -266,8 +266,11 @@ WebSocketTracker.prototype._onAnnounceResponse = function (data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.complete != null) {
|
if (data.complete != null) {
|
||||||
data.announce = self.announceUrl
|
var response = Object.assign({}, data, {
|
||||||
self.client.emit('update', data)
|
announce: self.announceUrl,
|
||||||
|
infoHash: common.binaryToHex(data.info_hash)
|
||||||
|
})
|
||||||
|
self.client.emit('update', response)
|
||||||
}
|
}
|
||||||
|
|
||||||
var peer
|
var peer
|
||||||
@ -323,16 +326,13 @@ WebSocketTracker.prototype._onScrapeResponse = function (data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
keys.forEach(function (infoHash) {
|
keys.forEach(function (infoHash) {
|
||||||
var response = data[infoHash]
|
|
||||||
// TODO: optionally handle data.flags.min_request_interval
|
// TODO: optionally handle data.flags.min_request_interval
|
||||||
// (separate from announce interval)
|
// (separate from announce interval)
|
||||||
self.client.emit('scrape', {
|
var response = Object.assign(data[infoHash], {
|
||||||
announce: self.announceUrl,
|
announce: self.announceUrl,
|
||||||
infoHash: common.binaryToHex(infoHash),
|
infoHash: common.binaryToHex(infoHash)
|
||||||
complete: response.complete,
|
|
||||||
incomplete: response.incomplete,
|
|
||||||
downloaded: response.downloaded
|
|
||||||
})
|
})
|
||||||
|
self.client.emit('scrape', response)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user