Skip to content
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

Persist DHT nodes #1431

Open
wants to merge 9 commits into
base: master
from

Correct DHT state loading

Saved node data and the bootstrap list use different formats.
Converts to the bootstrap format.
  • Loading branch information
bookmoons committed Jul 30, 2018
commit ff755bc932d8d3abc585e03b4d303697cf8598d7
@@ -140,7 +140,14 @@ function WebTorrent (opts) {
if (!('bootstrap' in dhtOpts)) {
// Load persisted state
var nodes = dhtPersist.loadNodes(self.dhtSaveFile)
if (nodes) dhtOpts.bootstrap = nodes
if (nodes) {
var bootstrap = []
for (var node of nodes) {
var nodeString = node.host + ':' + node.port
bootstrap.push(nodeString)
}
dhtOpts.bootstrap = bootstrap
}
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.