From d35807f5a365d73bd81ade57c4adc5bfe0a102df Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 3 Jul 2014 20:05:02 -0700 Subject: [PATCH] emit port with 'listening' event --- README.md | 6 ++++-- server.js | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b2605fe..155475e 100644 --- a/README.md +++ b/README.md @@ -106,8 +106,8 @@ server.on('warning', function (err) { console.log(err.message) }) -server.on('listening', function () { - console.log('tracker server is listening!') +server.on('listening', function (port) { + console.log('tracker server is now listening on ' + port) }) // start tracker server listening! @@ -137,6 +137,8 @@ server.torrents[infoHash].incomplete server.torrents[infoHash].peers ``` +The http server will handle requests for the following paths: `/announce`, `/scrape`. Requests for other paths will not be handled. + ## license MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/server.js b/server.js index 2a94f71..c90009b 100644 --- a/server.js +++ b/server.js @@ -12,7 +12,6 @@ var parallel = require('run-parallel') var querystring = require('querystring') var string2compact = require('string2compact') - var REMOVE_IPV6_RE = /^::ffff:/ inherits(Server, EventEmitter) @@ -78,7 +77,7 @@ Server.prototype.listen = function (port, onlistening) { parallel(tasks, function (err) { if (err) return self.emit('error', err) - self.emit('listening') + self.emit('listening', port) }) }