This commit is contained in:
Mark Nadal 2020-02-10 17:48:39 -08:00
parent d6dae4871e
commit bc40109e61
6 changed files with 37 additions and 57 deletions

2
axe.js
View File

@ -109,7 +109,7 @@
at.on('in', input);
at.on('in2', input);
function input(msg){
var to = this.to, peer = (msg._||'').via || mesh.leap; // warning! mesh.leap could be buggy!
var to = this.to, peer = (msg._||'').via; // warning! mesh.leap could be buggy!
var dht = opt.dht;
var routes = axe.routes || (axe.routes = {}); // USE RAD INSTEAD! TMP TESTING!
var get = msg.get, hash, tmp;

View File

@ -1,8 +1,8 @@
;(function(){
/*var cluster = require('cluster');
var cluster = require('cluster');
if(cluster.isMaster){
return cluster.fork() && cluster.on('exit', function(){ cluster.fork() });
}*/
return cluster.fork() && cluster.on('exit', function(){ cluster.fork(); require('../lib/crashed'); });
}
var fs = require('fs');
var config = { port: process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765 };

View File

@ -113,31 +113,6 @@
<script src="/jquery.js"></script>
<script src="/gun.js"></script>
<script src="/gun/nts.js"></script>
<h1><button id="spamit">SPAM</button></h1><script>spamit.onclick = function(){
if(window.TO){ clearInterval(window.TO); return; }
window.TO = setInterval(function(){
var w = 2;
function go(i){
var S = +new Date;
var ref = gun.get(Gun.text.random(12)).put({data: Math.random(), ah: Math.random()}, function(ack){
console.log((+new Date - S)/1000, ack.err, ack.ok);
ref.off();
});
}
while(w--){ go(w) }
},1)
}
Gun.on('opt', function(root){
root.opt.localStorage = false;
this.to.next(root);
if(root.once){ return }
root.on('out', function(msg){
msg.DBG_s = +new Date;
this.to.next(msg);
})
})
</script>
<script>
// Check out the interactive tutorial
// for how to build a simplified version

2
gun.js
View File

@ -2170,7 +2170,7 @@
}
//LOG && opt.log(S, +new Date - S, 'say prep');
dup_track(id);//.it = it(msg); // track for 9 seconds, default. Earth<->Mars would need more!
if(!peer){ peer = ((tmp = dup.s[msg['@']]) && (tmp.via || ((tmp = tmp.it) && (tmp = tmp._) && tmp.via))) || mesh.leap } // warning! mesh.leap could be buggy!
if(!peer && (tmp = msg['@'])){ peer = ((tmp = dup.s[tmp]) && (tmp.via || ((tmp = tmp.it) && (tmp = tmp._) && tmp.via))) || mesh.leap } // warning! mesh.leap could be buggy!
if(!peer && msg['@']){
LOG && opt.log(+new Date, ++SMIA, 'total no peer to ack to');
return false;

32
lib/crashed.js Normal file
View File

@ -0,0 +1,32 @@
;(function(){ try {
var fs = require('fs'), logs = [], up = __dirname+'/../';
fs.readdir(up, function(err, list){ try{
var i = 0, f; while(f = list[i++]){
if(0 === f.indexOf('isolate-') && '.log' === f.slice(-4)){ logs.push(f) }
}
logs = logs.sort();
f = logs[logs.length-1];
if(!f){ return }
fs.rename(up+f, up+'v8.log', function(err,ok){
var i = 0, f; while(f = logs[i++]){
fs.unlink(up+f, noop);
}
if(!process.env.EMAIL){ return } // ONLY EMAIL IF DEVELOPER OPTS IN!!!
email(); // ONLY EMAIL IF DEVELOPER OPTS IN!!!
});
}catch(e){} });
function noop(){};
function email(){ try{
if(!process.env.EMAIL){ return } // ONLY EMAIL IF DEVELOPER OPTS IN!!!
var address = process.env.EMAIL || "mark@gun.eco";
// you also have to specify your EMAIL_KEY gmail 2F' app's password (not reg) to send out.
require('./email').send({
text: "log attached",
from: address,
to: address,
subject: "GUN V8 LOG",
attachment:[{path: up+'v8.log', type:"text/plain", name:"v8.log"}]
}, noop);
}catch(e){} };
}catch(e){}
}());

View File

@ -1,27 +0,0 @@
;(async function start(){
var z;
try{ z = require('0x');
} catch(e){
return require('./examples/http.js');
}
function go(){
start();
setTimeout(function(){try{
var zip = require("child_process");
zip.execSync('zip -r flametracedata.zip flamedata/');
require('./lib/fsrm')('./flamedata');
require('./lib/email').send({
text: "zip attached",
from: "mark@gun.eco",
to: "mark@gun.eco",
subject: "TRACE GUN",
attachment:[{path: __dirname+"/flametracedata.zip", type:"application/zip", name:"flametracedata.zip"}]
}, function(err){
if(!err){ return }
console.log("@@@@@@@@@@ EMAIL ERROR @@@@@@@@@@", err);
require('./lib/email').send({text: "check https://gunjs.herokuapp.com/gun/flametracedata.zip", from: "mark@gun.eco", to: "mark@gun.eco", subject: "TRACE GUN CHECK"}, function(err){});
})
}catch(err){ console.log("@@@@@@@@@@ TRACE ERROR @@@@@@@@@", err) }},5000);
}
require('0x')({argv: ['./examples/http.js'], outputDir: 'flamedata', workingDir: __dirname, onProcessExit: go});
}());