some minor fixes, removal of unused code, etc.

This commit is contained in:
Daniel Sommer 2022-05-02 15:03:07 +02:00
parent 717f1d1fc6
commit 9e7b04d4b1
4 changed files with 13 additions and 11 deletions

View file

@ -54,7 +54,7 @@ class StreamBuffer extends EventEmitter {
announced: false announced: false
}; };
this.limit = { this.limit = {
value: config?.buffer?.limit, value: config?.buffer?.limit * 1048576,
announced: false announced: false
}; };
if (isNaN(this.limit.value) || this.limit.value < this.threshold.value) { if (isNaN(this.limit.value) || this.limit.value < this.threshold.value) {

View file

@ -75,6 +75,10 @@ class Audiostream {
logger.info('connection to audio server \'' + this.getTag() + '\' closed'); logger.info('connection to audio server \'' + this.getTag() + '\' closed');
}); });
} }
destroy() {
}
} }
module.exports = Audiostream; module.exports = Audiostream;

View file

@ -16,6 +16,8 @@ class Connection {
} }
this.host = config?.server?.host || "127.0.0.1"; this.host = config?.server?.host || "127.0.0.1";
this.port = config?.server?.port || "3000"; this.port = config?.server?.port || "3000";
this.eventParser = new EventParser();
this.audiostream = new Audiostream(this.eventParser);
} }
getHost() { getHost() {
@ -51,8 +53,6 @@ class Connection {
#handleEventConnect(resolve, socket) { #handleEventConnect(resolve, socket) {
logger.info('connected to communication server \'' + this.getTag() + '\'...'); logger.info('connected to communication server \'' + this.getTag() + '\'...');
this.socket = socket; this.socket = socket;
this.eventParser = new EventParser();
this.audiostream = new Audiostream(this.eventParser);
this.heartbeat = new Heartbeat(this.eventParser); this.heartbeat = new Heartbeat(this.eventParser);
this.#handleHeartbeat(); this.#handleHeartbeat();
socket.on('timeout', () => { socket.on('timeout', () => {
@ -91,11 +91,6 @@ class Connection {
}); });
} }
#handleAudioEvents() {
}
destroy() { destroy() {
if (this.heartbeat !== undefined) { if (this.heartbeat !== undefined) {
this.heartbeat.destroy(); this.heartbeat.destroy();
@ -112,6 +107,10 @@ class Connection {
this.socket.destroy(); this.socket.destroy();
this.socket = undefined; this.socket = undefined;
} }
if (this.audiostream !== undefined) {
this.audiostream.destroy();
}
} }
} }

View file

@ -13,7 +13,6 @@
"delay": 1000 "delay": 1000
}, },
"buffer": { "buffer": {
"limit": 40960 "limit": 64
}, }
"tmp": "/tmp/kannon.tmp"
} }