Compare commits

...

2 Commits
master ... v1.3

Author SHA1 Message Date
AJ ONeal 630fd7efbf handle bad packet more correctly 2018-02-21 11:39:43 -07:00
AJ ONeal 313f0a70a6 enable tcp by default 2017-12-14 20:28:13 -07:00
2 changed files with 3 additions and 8 deletions

View File

@ -67,12 +67,6 @@ cli.main(function (args, cli) {
}
});
if (!cli.tcp) {
if (!cli.notcp) {
console.info("[WARNING] Set '+notcp' to disable tcp connections. The default behavior changes to +tcp in v1.3");
}
}
if (cli.mdns) {
if (!cli.type) {
cli.type = cli.t = 'PTR';
@ -406,7 +400,7 @@ cli.main(function (args, cli) {
}
}
});
if (cli.tcp /* TODO v1.3 !cli.notcp */) {
if (!cli.notcp) {
require('../lib/tcpd.js').create(cli, dnsd);
}

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);