diff --git a/lib/torrent.js b/lib/torrent.js index f14cf4ea..0400c635 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -93,6 +93,7 @@ function Torrent (torrentId, client, opts) { this.pieces = [] this._selections = [] this._critical = [] + this._getExtraAnnounceOpts = opts.getExtraAnnounceOpts // for cleanup this._servers = [] @@ -298,7 +299,15 @@ Torrent.prototype._onSwarmListening = function () { peerId: self.client.peerId, port: self.client.torrentPort, rtcConfig: self.client._rtcConfig, - wrtc: self.client._wrtc + wrtc: self.client._wrtc, + getAnnounceOpts: function () { + return { + uploaded: self.uploaded, + downloaded: self.downloaded, + left: self.length - self.downloaded, + extraAnnounceOpts: self._getExtraAnnounceOpts && self._getExtraAnnounceOpts() + } + } }) self.discovery.on('error', self._onError.bind(self)) self.discovery.on('peer', self.addPeer.bind(self))