mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 12:11:36 +00:00
server: make onHttpRequest() part of public API
This commit is contained in:
parent
3b4b487c2c
commit
2f7a7131d0
@ -9,7 +9,7 @@ var server = new Server({
|
||||
udp: false // not interested
|
||||
})
|
||||
|
||||
var onHttpRequest = server._onHttpRequest.bind(server)
|
||||
var onHttpRequest = server.onHttpRequest.bind(server)
|
||||
app.get('/announce', onHttpRequest)
|
||||
app.get('/scrape', onHttpRequest)
|
||||
|
||||
|
@ -54,7 +54,7 @@ function Server (opts) {
|
||||
// default to starting an http server unless the user explictly says no
|
||||
if (opts.http !== false) {
|
||||
self._httpServer = http.createServer()
|
||||
self._httpServer.on('request', self._onHttpRequest.bind(self))
|
||||
self._httpServer.on('request', self.onHttpRequest.bind(self))
|
||||
self._httpServer.on('error', self._onError.bind(self))
|
||||
self._httpServer.on('listening', onListening)
|
||||
}
|
||||
@ -123,7 +123,7 @@ Server.prototype.getSwarm = function (infoHash) {
|
||||
return swarm
|
||||
}
|
||||
|
||||
Server.prototype._onHttpRequest = function (req, res) {
|
||||
Server.prototype.onHttpRequest = function (req, res) {
|
||||
var self = this
|
||||
|
||||
var params
|
||||
|
Loading…
Reference in New Issue
Block a user