-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P2P updater #473
P2P updater #473
Conversation
* P2P updater * Update Updater.js * Add UpdateSeed on Settings * Add Webtorrent on package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THANK YOU, for a very interesting PR.
i'm not sure why we change the way the update is installed once finished, i'd like this to be optional for now, and before we merge we need to setup the butter infrastructure for this.
src/app/global.js
Outdated
@@ -57,6 +57,6 @@ var | |||
|
|||
// Torrent engines | |||
peerflix = require('peerflix'), | |||
|
|||
WebTorrent = require('webtorrent'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this as a global, please keep it in updater.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can change that when it gets merged.
@@ -149,6 +149,7 @@ Settings.tmpLocation = path.join(os.tmpDir(), Settings.projectName); | |||
Settings.databaseLocation = path.join(data_path, 'data'); | |||
Settings.deleteTmpOnClose = true; | |||
Settings.automaticUpdating = true; | |||
Settings.UpdateSeed = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either Settings.update = {seed: true}
, or Settings.seedUpdate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Settings.seedUpdate is a parameter on setting container ,
People can disable seeding if they are on the last version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's just a name nitpick 'seedUpdate' isn't really clear to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how windowsy of you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming convention is bad, you should use seedUpdate or redistributeUpdater, but don't start with an uppercase :)
I am not sure what you mean by changing the updater behavior but we just included web torrent and kept the Flow of the current updater |
your PR changed a lot of things (more than can be reviewed) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some remarks
@@ -149,6 +149,7 @@ Settings.tmpLocation = path.join(os.tmpDir(), Settings.projectName); | |||
Settings.databaseLocation = path.join(data_path, 'data'); | |||
Settings.deleteTmpOnClose = true; | |||
Settings.automaticUpdating = true; | |||
Settings.UpdateSeed = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming convention is bad, you should use seedUpdate or redistributeUpdater, but don't start with an uppercase :)
@@ -60,6 +60,7 @@ | |||
"nodecast-js": "^1.0.1", | |||
"opensubtitles-api": "^3.1.0", | |||
"peerflix": "^0.35.0", | |||
"webtorrent": "0.97.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better use 0.x.x or ^0.97.2
<input class="settings-checkbox" name="events" id="cb6" type="checkbox" <%=(Settings.events? "checked='checked'":"")%>> | ||
<label class="settings-label" for="cb6"><%= i18n.__("Celebrate various events") %></label> | ||
<input class="settings-checkbox" name="UpdateSeed" id="cb6" type="checkbox" <%=(Settings.UpdateSeed? "checked='checked'":"")%>> | ||
<label class="settings-label" for="cb6"><%= i18n.__("Activate Update Seeding") %></label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's personnal and doesn't really impair the merge of this, but I don't like the string. For starter, you don't need the word "activate" in it, the checkbox says that already.
How about:
- "Seed update files to other users"
- "Redistribute the update packages"
@@ -3,6 +3,8 @@ | |||
|
|||
var CHANNELS = ['stable', 'beta', 'nightly'], | |||
FILENAME = 'package.nw.new', | |||
WebTorrent = require('webtorrent'), | |||
client = new WebTorrent({dht: true,maxConns: '5'}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the maxConns needed? It fallsback to 55, why forcing a lower number?
win.debug('ERROR' + err.message); | ||
}); | ||
torrent.on('done', function () { | ||
win.debug('Seeding the Current Update!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once 'done', it doesn't seed, according to my tests. You need to explicitly set it with the .seed() api call (I think?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so it looks like seed() is to create a new torrent, i'm not sure how seed control works...
}, function (torrent) { | ||
win.debug('Downloading update... Please allow a few minutes'); | ||
torrent.on('error', function (err) { | ||
win.debug('ERROR' + err.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be win.warn('Downloading update failed:', error)
? Make it visible but not a 'breaking' error, and also comprehensible.
}); | ||
torrent.on('done', function () { | ||
win.debug('Update downloaded!'); | ||
defer.resolve(path.join(outputDir, torrent.name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
torrent.name contains the extension of the file in this case? Because there's a risk it's a directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we create the update torrent.
closing as #545 rebases it |
##P2P updater
Changes proposed in this pull request:
I've read the Contributor License Agreement