HACK: OS X: Disable WebRTC peers to fix 100% CPU issue caused by Chrome
bug.
Fixed in Chrome 51, so we can remove this hack once Electron updates
Chrome.
For #353.
WebTorrent 0.91 changed how duplicate torrents are handled, which broke
handling in WebTorrent Desktop.
After this PR:
- No more try-catch on client.add -- this has never thrown errors.
- No check for duplicate torrent.key value since client.add no longer
returns the same torrent object when adding a duplicate torrent. It
emits 'error' instead, and that case is already handled :)
This works around a WebTorrent bug where calling client.add(torrentFilePath) to add a duplicate torrent -- in other words, one whose infoHash we're already torrenting -- creates a new torrent object and later throws an error. Inconsistently, calling client.add(magnetURI) or client.add(infoHash) to add a duplicate torrent returns the existing torrent object that we're already torrenting and doesn't throw an error.
This also fixes a prety nasty bug where pasting a dupe magnet link changed the torrentKey of an existing torrent, breaking the communication between the main and WebTorrent windows
Fixes#364
* Separate hidden window, with its own renderer process, for WebTorrent
(Must be a window. You cannot run WebRTC at all in a Web Worker, and you can't
run it well in a node process like the electron main process.)
* Disabled the create-torrent-modal for now. That gives us a consistent UX
regardless of whether the user dragged files or folders onto the app or opened
the Create New Torrent menu item.
* Main process routes all messages between the main and webtorrent windows.
* The renderer index.js is smaller now (but still too big), with the WebTorrent
interface moved to webtorrent.js / it's own process.
* The UI should be faster now, and should not lag under load.