Torrent warning & error events

Fixes #253
This commit is contained in:
DC
2016-04-03 16:17:50 -07:00
parent e19cc98d91
commit 882a99f4ba

View File

@@ -588,6 +588,18 @@ function addTorrentEvents (torrent) {
})
torrent.on('ready', torrentReady)
torrent.on('done', torrentDone)
torrent.on('warning', onWarning)
torrent.on('error', torrentError)
function torrentError (err) {
console.log('error, stopping torrent %s (%s):\n\t%o',
torrent.name, torrent.infoHash, err.message)
// TODO: update torrentSummary, even if it doesn't have an infohash yet
if (torrent.infoHash) {
getTorrentSummary(torrent.infoHash).status = 'paused'
update()
}
}
function torrentReady () {
// Summarize torrent