Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make some torrent methods private

  • Loading branch information...
commit 67be9daf627bb7d9d068f3ef16011a7ae4df939f 1 parent 948d2ce
@feross authored
Showing with 8 additions and 9 deletions.
  1. +8 −9 lib/torrent.js
View
17 lib/torrent.js
@@ -8,7 +8,7 @@ var parseTorrent = require('parse-torrent')
var Swarm = require('bittorrent-swarm')
var METADATA_BLOCK_SIZE = 16 * 1024
-var WIRE_TIMEOUT = 10000
+var PIECE_TIMEOUT = 10000
var EXTENDED_MESSAGES = {
ut_metadata: 1
@@ -85,8 +85,8 @@ Torrent.prototype._onWire = function (wire) {
// dht.add(wire.remoteAddress, port)
})
- // Timeout for wire requests to this peer
- wire.setTimeout(WIRE_TIMEOUT)
+ // Timeout for piece requests to this peer
+ wire.setTimeout(PIECE_TIMEOUT)
// Support extended messages:
// - ut_metadata (metadata fetching, trackerless torrents)
@@ -183,7 +183,7 @@ Torrent.prototype._onUtMetadata = function (wire, buf) {
info: self.metadata
})
- self.onMetadata()
+ self._onMetadata()
break
// ut_metadata reject (peer doesn't have piece we requested)
// {'msg_type': 2, 'piece': 0}
@@ -193,18 +193,17 @@ Torrent.prototype._onUtMetadata = function (wire, buf) {
}
}
-Torrent.prototype.onMetadata = function () {
+Torrent.prototype._onMetadata = function () {
var self = this
- var parsed
try {
- parsed = parseTorrent(self.torrentFile)
+ self.parsedTorrent = parseTorrent(self.torrentFile)
} catch (e) {
console.error(e)
return
}
- console.log(parsed)
- // self.file = new Buffer(parsed)
+ console.log(self.parsedTorrent)
+ self.name = self.parsedTorrent.name
}
//
Please sign in to comment.
Something went wrong with that request. Please try again.