handle bad packet more correctly

This commit is contained in:
AJ ONeal 2018-02-21 11:38:24 -07:00
parent d6f0dc83d3
commit 1517ba0a4b
1 changed files with 2 additions and 1 deletions

View File

@ -27,9 +27,10 @@ module.exports.create = function (cli, dnsd) {
// TODO pad two bytes for lengths
dnsd.onMessage(nb, function (err, newAb, dbgmsg) {
var lenbuf = Buffer.from([ newAb.length >> 8, newAb.length & 255 ]);
// TODO XXX generate legit error packet
if (err) { console.error("Error", err); c.end(); return; }
var lenbuf = Buffer.from([ newAb.length >> 8, newAb.length & 255 ]);
console.log('TCP ' + dbgmsg);
c.write(lenbuf);