Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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