Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohrensessel/989962c46147cb89402c08639d6bafbb to your computer and use it in GitHub Desktop.
Save ohrensessel/989962c46147cb89402c08639d6bafbb to your computer and use it in GitHub Desktop.
diff --git a/modules/receiver/announced.js b/modules/receiver/announced.js
index 21f1128..4c583c1 100644
--- a/modules/receiver/announced.js
+++ b/modules/receiver/announced.js
@@ -72,16 +72,19 @@ module.exports = function(receiverId, configData, api) {
})
})
- function retrieve(stat, address) {
+ async function retrieve(stat, address) {
const ip = address ? address : config.target.ip
const req = Buffer.from('GET ' + stat)
- api.sharedConfig.ifaces.forEach(function(iface) {
- collector.setMulticastInterface(ip + '%' + iface)
- collector.send(req, 0, req.length, config.target.port, ip + '%' + iface, function (err) {
- if (err) console.error(err)
- })
- })
+ for (const iface of api.sharedConfig.ifaces) {
+ await new Promise((resume) => {
+ collector.setMulticastInterface('::%' + iface)
+ collector.send(req, 0, req.length, config.target.port, ip, function (err) {
+ if (err) console.error(err)
+ resume()
+ })
+ })
}
+}
collector.on('listening', function() {
collector.setTTL(1) // restrict hop-limit to own subnet / should prevent loops (default was: 64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment