don't trust this commit!

This commit is contained in:
Mark Nadal 2015-09-30 14:26:48 -07:00
parent 3883a5d648
commit d2f1b6b400
3 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 80;
var Gun = require('gun');
var Gun = require('../');// require('gun');
var gun = Gun({
file: 'data.json',
s3: {

View File

@ -22,6 +22,7 @@
if(!ws || !ws.send || !ws._socket || !ws._socket.writable){ return this.off() }
if(!msg || (msg.headers && msg.headers['gun-sid'] === ws.sid)){ return }
if(msg && msg.headers){ delete msg.headers['ws-rid'] }
// TODO: BUG? ^ What if other peers want to ack? Do they use the ws-rid or a gun declared id?
try{ws.send(Gun.text.ify(msg));
}catch(e){} // juuuust in case.
});
@ -143,7 +144,7 @@
// This will give you much more fine-grain control over security, transactions, and what not.
var reply = {headers: {'Content-Type': tran.json}};
if(!req.body){ return cb({headers: reply.headers, body: {err: "No body"}}) }
gun.server.on('network').emit(req);
gun.server.on('network').emit(Gun.obj.copy(req));
if(tran.put.key(req, cb)){ return }
// some NEW code that should get revised.
if(Gun.is.node(req.body) || Gun.is.graph(req.body)){

View File

@ -1886,7 +1886,7 @@ describe('Gun', function(){
describe('Streams', function(){
var gun = Gun(), g = function(){
return Gun({hooks: {get: ctx.get}});
}, ctx = {gen: 5, extra: 45, network: 2};
}, ctx = {gen: 9, extra: 45, network: 2};
it('prep hook', function(done){
this.timeout(ctx.gen * ctx.extra);