Skip to content

Commit

Permalink
Update browser.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Liniik authored Dec 17, 2020
1 parent 7b00685 commit 393b35e
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,16 @@ Browser.prototype.start = function () {
if (matches.length === 0) return

matches.forEach(function (service) {
if (!self._serviceMap[service.fqdn]) { // add all addresses to existing service for cases when localhost is found as first
self._addService(service)
if (self._serviceMap[service.fqdn]) {
debug("da")
debug(service)
self.emit("update", service)
return
} else {
debug("nyet")
debug(service)
}

const serviceToUpdate = self.services.filter(s => s.fqdn === service.fqdn)[0]
let addressCount = serviceToUpdate.addresses.length

createSet(serviceToUpdate, service)

if (addressCount !== serviceToUpdate.addresses.length) {
self.emit('update', serviceToUpdate)
}
self._addService(service)
})
})
}
Expand Down

0 comments on commit 393b35e

Please sign in to comment.