diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | index.js | 8 | ||||
-rw-r--r-- | lib/bittorrent-dht/index.js | 7 |
3 files changed, 6 insertions, 11 deletions
@@ -55,7 +55,7 @@ Since WebTorrent is web-first, it's dead simple for users to use without underta ## Planned NPM modules - [webtorrent](https://github.com/feross/webtorrent) (this repo) -- [magnet-link](https://github.com/feross/magnet-uri) +- [magnet-uri](https://github.com/feross/magnet-uri) - webtorrent-chrome - webtorrent-protocol - webtorrent-dht @@ -4,14 +4,13 @@ window.log = function (/* ... */) { if (process.env.DEBUG !== 'false') console.log.apply(console, arguments) } +window.bops = require('bops') var isChromeApp = !!(window.chrome && chrome.app && chrome.app.runtime) if (isChromeApp) { log('This is a Chrome App') } -window.bops = require('bops') - var magnet = require('magnet-uri') var DHT = require('./lib/bittorrent-dht') @@ -20,9 +19,10 @@ var leaves = 'D2474E86C95B19B8BCFDB92BC12C9D44667CFA36' var leavesMagnet = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36&dn=Leaves+of+Grass+by+Walt+Whitman.epub&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337' -console.log(magnet(leavesMagnet)) +var parse = magnet(leavesMagnet) +var infoHash = parse.xt.split('urn:btih:')[1] -window.dht = new DHT(pride) +window.dht = new DHT(infoHash) dht.on('node', function (node, infoHash) { // log('node: ' + node) }) diff --git a/lib/bittorrent-dht/index.js b/lib/bittorrent-dht/index.js index e90d725..4d47f16 100644 --- a/lib/bittorrent-dht/index.js +++ b/lib/bittorrent-dht/index.js @@ -150,7 +150,7 @@ DHT.prototype._onData = function (data, host, port) { } if (!message.t || (bops.to(message.t) !== self.requestId.toString())) { - log('wrong message requestId: ', bops.to(message.t), self.requestId) + log('wrong message requestId: ', bops.to(message.t), self.requestId.toString(), host, port) return } @@ -209,8 +209,3 @@ DHT.prototype.__defineGetter__('nodesFound', function () { var self = this return Object.keys(self.nodes).length }) - -DHT.prototype.__defineGetter__('queued', function () { //TODO - return 0 -}) - |