okTurtles / dnschain

A blockchain-based DNS + HTTP server that fixes HTTPS security, and more!
https://okturtles.com
Other
1.73k stars 170 forks source link

MX record related exception in native-dns-packet #90

Closed taoeffect closed 9 years ago

taoeffect commented 9 years ago

Send a fix to that project for this:

debug: [DNS] received question
{ name: 'audi.dns',
  type: 15,
  class: 1 }
debug: [DNS]
{ fn: 'cb|.dns',
  q:
   { name: 'audi.dns',
     type: 15,
     class: 1 },
  answer:
   [ { type: 15,
       class: 1,
       name: 'audi.dns',
       address: '192.184.93.146',
       ttl: 995 } ] }

events.js:72
        throw er; // Unhandled 'error' event
              ^
AssertionError: MX record requires "priority"
  at assertUndefined (/usr/local/lib/node_modules/dnschain/node_modules/native-dns/node_modules/native-dns-packet/packet.js:36:3)
  at writeMx (/usr/local/lib/node_modules/dnschain/node_modules/native-dns/node_modules/native-dns-packet/packet.js:293:3)
  at Function.Packet.write (/usr/local/lib/node_modules/dnschain/node_modules/native-dns/node_modules/native-dns-packet/packet.js:467:19)
  at [object Object].Packet.send (/usr/local/lib/node_modules/dnschain/node_modules/native-dns/lib/packet.js:43:16)
  at DNSServer.callback (/usr/local/lib/node_modules/dnschain/src/lib/dns.coffee:156:21)
  at [object Object].emit (events.js:98:17)
  at [object Object].Server.handleMessage (/usr/local/lib/node_modules/dnschain/node_modules/native-dns/lib/server.js:68:10)
  at Socket.<anonymous> (/usr/local/lib/node_modules/dnschain/node_modules/native-dns/lib/server.js:80:10)
  at Socket.emit (events.js:98:17)
  at UDP.onMessage (dgram.js:440:8)
taoeffect commented 9 years ago

Simply placing this code in a try/catch will fix this problem (with a @sendErr in the catch, as done here).

However, the correct way to fix this is to both do that, and also close issue #87. Since that's assigned to @WeMeetAgain, it makes sense for to assign this (easily fixed) issue to @WeMeetAgain as well (to prevent merge conflicts).

taoeffect commented 9 years ago

Since #87 is closed this shouldn't be a problem.