Skip to content

Commit

Permalink
Improve filtering in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Jan 23, 2016
1 parent b0c7842 commit aea960b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Browser.prototype._removeService = function (fqdn) {
function goodbyes (name, packet) {
return packet.answers.concat(packet.additionals)
.filter(function (rr) {
return dnsEqual(rr.name, name) && rr.type === 'PTR' && rr.ttl === 0
return rr.type === 'PTR' && rr.ttl === 0 && dnsEqual(rr.name, name)
})
.map(function (rr) {
return rr.data
Expand All @@ -105,7 +105,7 @@ function buildServicesFor (name, packet) {

return records
.filter(function (rr) {
return dnsEqual(rr.name, name) && rr.type === 'PTR'
return rr.type === 'PTR' && dnsEqual(rr.name, name)
})
.map(function (ptr) {
var service = {
Expand All @@ -114,7 +114,7 @@ function buildServicesFor (name, packet) {

records
.filter(function (rr) {
return dnsEqual(rr.name, ptr.data) && (rr.type === 'SRV' || rr.type === 'TXT')
return (rr.type === 'SRV' || rr.type === 'TXT') && dnsEqual(rr.name, ptr.data)
})
.forEach(function (rr) {
if (rr.type === 'SRV') {
Expand All @@ -136,7 +136,7 @@ function buildServicesFor (name, packet) {

records
.filter(function (rr) {
return dnsEqual(rr.name, service.host) && (rr.type === 'A' || rr.type === 'AAAA')
return (rr.type === 'A' || rr.type === 'AAAA') && dnsEqual(rr.name, service.host)
})
.forEach(function (rr) {
service.addresses.push(rr.data)
Expand Down

0 comments on commit aea960b

Please sign in to comment.