emit 'warning' for unsupported tracker protocol

This commit is contained in:
Feross Aboukhadijeh 2015-05-29 14:24:28 -07:00
parent 68f0d7e46d
commit 8e29227003

View File

@ -79,6 +79,11 @@ function Client (peerId, port, torrent, opts) {
return new UDPTracker(self, announceUrl, trackerOpts)
} else if ((protocol === 'ws:' || protocol === 'wss:') && webrtcSupport) {
return new WebSocketTracker(self, announceUrl, trackerOpts)
} else {
process.nextTick(function () {
var err = new Error('unsupported tracker protocol for ' + announceUrl)
self.emit('warning', err)
})
}
return null
})