default NodeJS to superpeer!

This commit is contained in:
Mark Nadal 2018-05-16 16:46:02 -07:00
parent 102731a710
commit 7e5fd2e398
3 changed files with 14 additions and 5 deletions

7
gun.js
View File

@ -748,8 +748,11 @@
function merge(node, soul){
var ctx = this, cat = ctx.gun._, at = (cat.next || empty)[soul];
if(!at){
ctx.souls[soul] = false;
return
if(!(cat.opt||empty).super){
ctx.souls[soul] = false;
return;
}
at = (ctx.gun.get(soul)._);
}
var msg = ctx.map[soul] = {
put: node,

View File

@ -11,7 +11,7 @@
ev.max = parseFloat(root.opt.memory || process.env.WEB_MEMORY || 512) * 0.8;
setInterval(check, 250);
setInterval(check, 1000);
function check(){
var used = ev.used = util().heapTotal / 1024 / 1024;
if(used < ev.max){ return }
@ -19,7 +19,7 @@
}
function GC(){
var souls = Object.keys(root.graph||empty);
var toss = Math.ceil(souls.length * 0.1);
var toss = Math.ceil(souls.length * 0.01);
//var start = Gun.state(), i = toss;
Gun.list.map(souls, function(soul){
if(--toss < 0){ return }

View File

@ -1,6 +1,12 @@
;(function(){
var Gun = require('../gun');
var Gun = require('../gun'), u;
Gun.serve = require('./serve');
Gun.on('opt', function(root){
this.to.next(root);
if(root.once){ return }
if(u !== root.opt.super){ return }
root.opt.super = true;
})
require('../nts');
require('./store');
require('./rs3');