emit port with 'listening' event

This commit is contained in:
Feross Aboukhadijeh 2014-07-03 20:05:02 -07:00
parent ba6d85c0a9
commit d35807f5a3
2 changed files with 5 additions and 4 deletions

View File

@ -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).

View File

@ -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)
})
}