2 Commits

Author SHA1 Message Date
918306647d Fixed chunk-error not being stopped after handling 2021-12-10 22:39:21 +01:00
3b10aca352 Added chunk-check against undefined 2021-12-10 20:09:05 +01:00
2 changed files with 9 additions and 2 deletions

View File

@@ -256,7 +256,7 @@ Variable|Description
Variable|Default|Description Variable|Default|Description
---|---|--- ---|---|---
`LOGLEVEL` | INFO | Loglevel `LOGLEVEL` | INFO | Loglevel
`WIFI_INTERFACE` | wlan0 | Wifi-Interface name in Monitor-Mode `WIFI_INTERFACE` | wlan0 | Token with write-access
~~`HOSTNAME`~~ | ~~Device's Hostname~~ | ~~Hostname to use as global hostname-tag~~ *(Unused)* ~~`HOSTNAME`~~ | ~~Device's Hostname~~ | ~~Hostname to use as global hostname-tag~~ *(Unused)*
<br> <br>

View File

@@ -47,8 +47,15 @@ class PacketStreamFactory extends Transform{
} }
_transform(chunk, encoding, next){ _transform(chunk, encoding, next){
let packet = new Packet(); if(!chunk){
const err = "Chunk was invalid!";
logger.error(err);
next(err);
return;
}
let packet = new Packet();
const lines = chunk.split("\n"); const lines = chunk.split("\n");
const header = lines.splice(0, 1)[0]; // Grab first line, "lines" is now the payload const header = lines.splice(0, 1)[0]; // Grab first line, "lines" is now the payload
packet = this._handleHeader(packet, header); packet = this._handleHeader(packet, header);