8e77cd37 by Jabis Sevón

Merge remote-tracking branch 'origin/master'

2 parents 99644135 4fd4d8d6
1 ;(function(){ 1 ;(function(){
2 var Gun = (typeof window !== "undefined")? window.Gun : require('gun'); 2 var Gun = (typeof window !== "undefined")? window.Gun : require("gun/gun");
3 var url = require('url'); 3 var url = require('url');
4 4
5 Gun.on('opt', function mount(ctx){ 5 Gun.on('opt', function mount(ctx){
...@@ -120,4 +120,4 @@ ...@@ -120,4 +120,4 @@
120 } 120 }
121 }); 121 });
122 var noop = function(){}; 122 var noop = function(){};
123 }());
...\ No newline at end of file ...\ No newline at end of file
123 }());
......
1 (function() { 1 (function() {
2 var Gun = typeof window !== "undefined" ? window.Gun : require("gun"); 2 var Gun = typeof window !== "undefined" ? window.Gun : require("gun/gun");
3 3
4 Gun.on("opt", function(ctx) { 4 Gun.on("opt", function(ctx) {
5 this.to.next(ctx); 5 this.to.next(ctx);
...@@ -29,6 +29,24 @@ ...@@ -29,6 +29,24 @@
29 to = setTimeout(flush, opt.wait || 1); 29 to = setTimeout(flush, opt.wait || 1);
30 }); 30 });
31 31
32 ctx.on("put", function(at) {
33 this.to.next(at);
34 Gun.graph.is(at.put, null, null);
35 if (!at["@"]) {
36 acks[at["#"]] = true;
37 } // only ack non-acks.
38 count += 1;
39 if (count >= (opt.batch || 10000)) {
40 return flush();
41 }
42 if (to) {
43 return;
44 }
45 to = setTimeout(flush, opt.wait || 1);
46 var id = at['#']
47 ctx.on('in', {"@": id, ok:1})
48 });
49
32 ctx.on("get", function(at) { 50 ctx.on("get", function(at) {
33 // this.to.next(at); //What does this do? 51 // this.to.next(at); //What does this do?
34 var lex = at.get, 52 var lex = at.get,
......
...@@ -51,7 +51,7 @@ server.on("upgrade", async function(request, socket, head) { ...@@ -51,7 +51,7 @@ server.on("upgrade", async function(request, socket, head) {
51 gun.gun = new Gun({ 51 gun.gun = new Gun({
52 peers: [], // should we use self as peer? 52 peers: [], // should we use self as peer?
53 localStorage: false, 53 localStorage: false,
54 file: false, // "tmp/" + pathname, 54 file: false,
55 radisk: false, 55 radisk: false,
56 multicast: false, 56 multicast: false,
57 ws: { noServer: true, path: pathname, web: gun.server }, 57 ws: { noServer: true, path: pathname, web: gun.server },
...@@ -67,6 +67,7 @@ server.on("upgrade", async function(request, socket, head) { ...@@ -67,6 +67,7 @@ server.on("upgrade", async function(request, socket, head) {
67 gun.server.emit("connection", ws, request); 67 gun.server.emit("connection", ws, request);
68 }); 68 });
69 } else { 69 } else {
70 if (debug) console.log("destroying socket", pathname);
70 socket.destroy(); 71 socket.destroy();
71 } 72 }
72 }); 73 });
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!