Skip to content
Snippets Groups Projects
Commit cf550424 authored by echicken's avatar echicken
Browse files

Revamped canvas history buffering to avoid JSON client max_recv limit...

Revamped canvas history buffering to avoid JSON client max_recv limit problems.  Kind of ugly, but I will refine it later.
parent d46d6fdd
Branches
Tags
No related merge requests found
...@@ -65,29 +65,26 @@ function cleanUp() { ...@@ -65,29 +65,26 @@ function cleanUp() {
console.clear(); console.clear();
} }
// This may be needed if canvas data starts to exceed the receive limit var index = 0;
/* var canvasLength = ansiClient.read("syncwall", "canvas." + monthYear + ".history.length", 1);
var canvas = ansiClient.keys("syncwall", "canvas." + monthYear, 1); var canvas = [];
if(canvas !== undefined) { if(canvasLength === undefined) {
for(var c = 0; c < canvas.length; c++) { ansiClient.write("syncwall", "canvas." + monthYear, { history : [] }, 2);
var ch = ansiClient.read("syncwall", "canvas." + monthYear + "." + canvas[c], 1); } else {
putCh(ch); while(index < canvasLength) {
mswait(chDelay); canvas.push(ansiClient.slice("syncwall", "canvas." + monthYear + ".history", index, 1000, 1));
index = index + 1000;
} }
} for(var c = 0; c < canvas.length; c++) {
*/ for(var cc = 0; cc < canvas[c].length; cc++) {
// So if you uncomment the above section, comment out this next bit: putCh(canvas[c][cc]);
var canvas = ansiClient.read("syncwall", "canvas." + monthYear, 1); if(ascii(console.inkey(K_NONE, chDelay)) == 27) {
if(canvas !== undefined) { cleanUp();
for(var c in canvas) { exit();
putCh(canvas[c]); }
if(ascii(console.inkey(K_NONE, chDelay)) == 27) {
cleanUp();
exit();
} }
} }
} }
// And stop commenting here.
while(ascii(userInput) != 27) { while(ascii(userInput) != 27) {
ansiClient.cycle(); ansiClient.cycle();
...@@ -105,8 +102,8 @@ while(ascii(userInput) != 27) { ...@@ -105,8 +102,8 @@ while(ascii(userInput) != 27) {
} }
ch.userAlias = user.alias; ch.userAlias = user.alias;
ch.system = system.name; ch.system = system.name;
pName = base64_encode(user.alias) + system.timer.toString().split(".").join(""); ansiClient.write("syncwall", "canvas." + monthYear + ".ch", ch, 2);
ansiClient.write("syncwall", "canvas." + monthYear + "." + pName, ch, 2); ansiClient.push("syncwall", "canvas." + monthYear + ".history", ch, 2);
} }
cleanUp(); cleanUp();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment