Created
June 27, 2020 22:28
-
-
Save ohrensessel/989962c46147cb89402c08639d6bafbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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