From: Paul J R Date: Mon, 4 Aug 2014 12:39:01 +0000 (+1000) Subject: bgpfake updates X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=206bcaaf74721621f7e97f851225bd9574ceff61;p=random_node_code.git bgpfake updates --- diff --git a/bgpfake/bf.js b/bgpfake/bf.js index 81c1f39..260fd9d 100644 --- a/bgpfake/bf.js +++ b/bgpfake/bf.js @@ -4,6 +4,8 @@ var num_to_create = 400000; var net = require('net'); +var updateSent = 0; + var scon; @@ -13,7 +15,7 @@ function createentry(i) { var b = 0; var c = 0; - var x = 101<<16; + var x = 45<<16; //console.log("var x is "+x); i = i+x; @@ -104,10 +106,11 @@ function parseBuffer(b, c) { c.write(out); } else if(type == 4) { console.log("writing keepalive - exact as sent"); + if(updateSent ==0) beginUpdateSend(c); c.write(b); } else if(type == 2) { console.log("got update..."); - beginUpdateSend(c); + if(updateSent ==0) beginUpdateSend(c); } else { console.log("sending end..."); c.end(); @@ -235,6 +238,7 @@ function constructUpdateMessage(localdata) { // start sending updates messages function beginUpdateSend(c) { + updateSent = 1; var n = 0; data.forEach(function(led) { c.write(led[2]);