Make WebTorrent process easier to debug

This commit is contained in:
DC
2016-04-05 19:17:23 -07:00
parent b8d9d29e90
commit 3080001d3d

View File

@@ -24,13 +24,13 @@ global.WEBTORRENT_ANNOUNCE = defaultAnnounceList
// Connect to the WebTorrent and BitTorrent networks. WebTorrent Desktop is a hybrid // Connect to the WebTorrent and BitTorrent networks. WebTorrent Desktop is a hybrid
// client, as explained here: https://webtorrent.io/faq // client, as explained here: https://webtorrent.io/faq
var client = new WebTorrent() var client = window.client = new WebTorrent()
// WebTorrent-to-HTTP streaming sever // WebTorrent-to-HTTP streaming sever
var server = null var server = window.server = null
// Used for diffing, so we only send progress updates when necessary // Used for diffing, so we only send progress updates when necessary
var prevProgress = null var prevProgress = window.prevProgress = null
init() init()
@@ -244,7 +244,6 @@ function getTorrentProgress () {
} }
function startServer (infoHash, index) { function startServer (infoHash, index) {
if (server) return
var torrent = client.get(infoHash) var torrent = client.get(infoHash)
if (torrent.ready) startServerFromReadyTorrent(torrent, index) if (torrent.ready) startServerFromReadyTorrent(torrent, index)
else torrent.on('ready', () => startServerFromReadyTorrent(torrent, index)) else torrent.on('ready', () => startServerFromReadyTorrent(torrent, index))