Skip to content

Commit

Permalink
api.ts cleanup logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed May 27, 2024
1 parent 804d5b7 commit 0b6fae4
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ class APIConnection

let packets = message.split('\0');

info("OnDataReceived ", message.length);
info("Buffer:", this.buffer.length);
info("packets.length:", packets.length);
info("OnDataReceived " + message.length + ", Buffer:" + this.buffer.length + ", packets.length:" + packets.length);

for(let i=0; i<packets.length; i++) {
let message = packets[i];
Expand All @@ -177,13 +175,13 @@ class APIConnection
this.buffer = "";
}
catch(e) {
printException('error parsing '+this.name, e);//+' request JSON: ' + this.buffer, e);
//printException('error parsing '+this.name, e);//+' request JSON: ' + this.buffer, e);
continue;
}
}

try {
info(this.name+" received data: ", data);
info(this.name+" received data: ", JSON.stringify(data));
success = true;
resp = this.callback(data);
} catch(e) {
Expand Down Expand Up @@ -212,7 +210,7 @@ class APIConnection
private end(data?:string) {
if(!this.sock) return;

info(this.name+'.end()');
info(this.name+'.end('+data.length+')');
try {
this.sock.off('close', this.onCloseCallback);
this.sock.on('close', this.onExpectedCloseCallback);
Expand All @@ -222,7 +220,7 @@ class APIConnection

try {
data = data ? data : '{"id": 0, "status": 0}\0';
info(this.name+'.sock.end('+data+')');
//info(this.name+'.sock.end('+data+')');
this.sock.end(data);
} catch(e) {
printException('error closing old '+this.name+' connection ', e);
Expand Down

0 comments on commit 0b6fae4

Please sign in to comment.