Skip to content

Commit

Permalink
some browserify discovered fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
quartzjer committed Feb 11, 2015
1 parent 125f6d5 commit 3921051
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions bin/router.js
Expand Up @@ -11,6 +11,7 @@ var argv = require('optimist')
repl.start(argv, function(mesh){
mesh.router(true);
mesh.discover(true);
mesh.accept = mesh.link; // auto-link any

mesh.rlog('router:',mesh.json());
mesh.rlog('router:',mesh.uri());
Expand Down
7 changes: 0 additions & 7 deletions browser.js

This file was deleted.

3 changes: 2 additions & 1 deletion ext/path.js
Expand Up @@ -20,7 +20,7 @@ exports.mesh = function(mesh, cbExt)
// go through all the pipes we have already and send a response
link.pipes.forEach(pong);
// add any of the included paths, and send to them too
if(Array.isArray(open.paths)) open.paths.forEach(function(path){
if(Array.isArray(open.json.paths)) open.json.paths.forEach(function(path){
link.addPath(path,pong);
});
}
Expand Down Expand Up @@ -48,6 +48,7 @@ exports.mesh = function(mesh, cbExt)
done = false;
cbChan();
}
mesh.log.debug('sending path ping to',link.hashname,json.paths);
channel.send({json:json});
}

Expand Down
11 changes: 8 additions & 3 deletions index.js
@@ -1,7 +1,7 @@
var fs = require('fs');

// we just wrap the shared code
var telehash = module.exports = require('./lib/mesh.js');
var telehash = global.telehash = module.exports = require('./lib/mesh.js');
var log = telehash.log();

// node specific extensions
Expand Down Expand Up @@ -57,8 +57,13 @@ module.exports.load = function(args, cbMesh)
if(fs.existsSync(args.id))
{
log.debug('loading id',args.id);
args.id = require(args.id);
return loaded();
var err;
try{
args.id = JSON.parse(fs.readFileSync(args.id));
}catch(E){
err = E;
}
return loaded(err);
}

// create new
Expand Down

0 comments on commit 3921051

Please sign in to comment.