Skip to content
Snippets Groups Projects
Commit 98f9f2c6 authored by mcmlxxix's avatar mcmlxxix
Browse files

Add buffering to server output, to maximize output and avoid being throttled.

Added "ABORT" command.
parent 42308eaf
No related branches found
No related tags found
No related merge requests found
......@@ -219,6 +219,13 @@ Bot_Commands["ENABLE"].command = function (target,onick,ouh,srv,lvl,cmd) {
return;
}
Bot_Commands["ABORT"] = new Bot_Command(80,false,false);
Bot_Commands["ABORT"].command = function (target,onick,ouh,srv,lvl,cmd) {
srv.buffers=[];
srv.o(target,"Server output aborted.");
return;
}
Bot_Commands["DISABLE"] = new Bot_Command(80,true,false);
Bot_Commands["DISABLE"].command = function (target,onick,ouh,srv,lvl,cmd) {
cmd.shift();
......
......@@ -288,7 +288,23 @@ function Server_Bot_Access(nick,uh) {
function Server_writeout(str) {
log("--> " + this.host + ": " + str);
this.sock.write(str.slice(0, 512) + "\r\n");
var target="~";
var target_buffer=false;
for(t=0;t<this.buffers.length;t++) {
if(this.buffers[t].target==target) {
target_buffer=this.buffers[t];
break;
}
}
if(target_buffer) {
target_buffer.buffer.push(str.slice(0, 512) + "\r\n");
} else {
new_buff=new Server_Buffer(target);
new_buff.buffer.push(str.slice(0, 512) + "\r\n");
this.buffers.push(new_buff);
}
}
function Server_target_out(target,str,msgtype) {
......@@ -302,7 +318,21 @@ function Server_target_out(target,str,msgtype) {
var outstr = msgtype + " " + target + " :" + str;
log("--> " + this.host + ": " + outstr);
this.sock.write(outstr.slice(0, 512) + "\r\n");
var target_buffer=false;
for(t=0;t<this.buffers.length;t++) {
if(this.buffers[t].target==target) {
target_buffer=this.buffers[t];
break;
}
}
if(target_buffer) {
target_buffer.buffer.push(outstr.slice(0, 512) + "\r\n");
} else {
new_buff=new Server_Buffer(target);
new_buff.buffer.push(outstr.slice(0, 512) + "\r\n");
this.buffers.push(new_buff);
}
}
function true_array_len(my_array) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment