aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-07-03 20:11:00 -0500
committerDavid Barksdale <amatus@amatus.name>2014-07-03 20:13:11 -0500
commit36038a312af2ee6a29c4adea974c3fe4eb821718 (patch)
treea9c78e1e2bb8afe7d1afbe4badde677d42432eb1
parent1d9d8e0b95551263ef605bba271bbd98c6ab5ecf (diff)
Setup presistent storage for peerinfo, fs, and nse.
-rw-r--r--README.md6
-rw-r--r--src/js/configuration.js7
-rw-r--r--src/js/pre.js28
3 files changed, 25 insertions, 16 deletions
diff --git a/README.md b/README.md
index 5249fd0..2ce7282 100644
--- a/README.md
+++ b/README.md
@@ -7,11 +7,12 @@ communication.
Roadmap
-------
* Compile GNUnet using [emscripten].
+ * gnunet-service-peerinfo.js - Done.
* gnunet-service-transport.js - Done, with HTTP(S) transport.
* gnunet-service-ats.js - Done.
* gnunet-daemon-topology.js - Done.
* gnunet-service-core.js - Done.
- * gnunet-service-nse.js - Done, PoW not persistent yet.
+ * gnunet-service-nse.js - Done.
* gnunet-service-dht.js - Done.
* gnunet-service-cadet.js - Done.
* gnunet-service-datastore.js - Building with heap backend plugin.
@@ -52,8 +53,7 @@ the services to schedule tasks, communicate with each other, and load plugins
are implemented as emscripten js libraries.
To debug a shared worker in chrome open chrome://inspect and click the
-"inspect" link next to the http://localhost:3000/js/gnunet-service-transport.js
-shared worker.
+"inspect" link next to an entry in the shared workers list.
[gnunet]: https://gnunet.org
[webrtc]: http://www.webrtc.org
diff --git a/src/js/configuration.js b/src/js/configuration.js
index 146d35f..877edc0 100644
--- a/src/js/configuration.js
+++ b/src/js/configuration.js
@@ -53,8 +53,7 @@ mergeInto(LibraryManager.library, {
DISABLE_BF: true,
},
nse: {
- // disable NSE for now
- //PROOFFILE: '/proof.dat',
+ PROOFFILE: '/nse/proof.dat',
WORKDELAY: '5 ms',
INTERVAL: '1 h',
WORKBITS: 22,
@@ -74,10 +73,10 @@ mergeInto(LibraryManager.library, {
CONTENT_CACHING: true,
CONTENT_PUSHING: true,
MAX_CADET_CLIENTS: 128,
- RESPECT: '/fs/credit/',
+ RESPECT: '/fs/credit',
},
peerinfo: {
- HOSTS: '/hosts/',
+ HOSTS: '/peerinfo/hosts',
},
},
GNUNET_CONFIGURATION_get_value__deps: ['$CONFIG'],
diff --git a/src/js/pre.js b/src/js/pre.js
index 97803c8..0fc1e50 100644
--- a/src/js/pre.js
+++ b/src/js/pre.js
@@ -32,7 +32,7 @@ gnunet_prerun = function() {
'datacache_heap',
'datastore_heap',
'transport_http_client',
- ].map(function(plugin) {
+ ].forEach(function(plugin) {
FS.createPreloadedFile('/', 'libgnunet_plugin_' + plugin + '.js',
'libgnunet_plugin_' + plugin + '.js', true, false);
});
@@ -52,14 +52,24 @@ gnunet_prerun = function() {
// addRunDependency("randomness")
// <gather randomness>
// removeRunDependency("randomness")
- FS.mkdir('/hosts');
- FS.mount(IDBFS, {}, '/hosts');
- addRunDependency('syncfs');
- FS.syncfs(true, function() { removeRunDependency('syncfs'); });
- var sync_callback = function() {
- setTimeout(function() { FS.syncfs(false, sync_callback); }, 5000);
- };
- sync_callback();
+
+ // Mount IDBFS for services that use it
+ var match;
+ if (match = location.pathname.match('gnunet-service-(.*).js')) {
+ var service = match[1];
+ var mounts = {peerinfo: true, fs: true, nse: true};
+ if (mounts[service]) {
+ var mount = '/' + service;
+ FS.mkdir(mount);
+ FS.mount(IDBFS, {}, mount);
+ addRunDependency('syncfs');
+ FS.syncfs(true, function() { removeRunDependency('syncfs'); });
+ var sync_callback = function() {
+ setTimeout(function() { FS.syncfs(false, sync_callback); }, 5000);
+ };
+ sync_callback();
+ }
+ }
}
if (typeof(Module) === "undefined") Module = { preRun: [] };
Module.preRun.push(gnunet_prerun);