mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 22:55:52 -05:00
Merge pull request #1624 from bartnv/master
Use bind address (if present) when checking redir port
This commit is contained in:
commit
154c503e97
@ -124,7 +124,7 @@ module.exports.CreateRedirServer = function (parent, db, args, func) {
|
|||||||
// Find a free port starting with the specified one and going up.
|
// Find a free port starting with the specified one and going up.
|
||||||
function CheckListenPort(port, addr, func) {
|
function CheckListenPort(port, addr, func) {
|
||||||
var s = obj.net.createServer(function (socket) { });
|
var s = obj.net.createServer(function (socket) { });
|
||||||
obj.tcpServer = s.listen(port, function () { s.close(function () { if (func) { func(port, addr); } }); }).on("error", function (err) {
|
obj.tcpServer = s.listen(port, addr, function () { s.close(function () { if (func) { func(port, addr); } }); }).on("error", function (err) {
|
||||||
if (args.exactports) { console.error("ERROR: MeshCentral HTTP server port " + port + " not available."); process.exit(); }
|
if (args.exactports) { console.error("ERROR: MeshCentral HTTP server port " + port + " not available."); process.exit(); }
|
||||||
else { if (port < 65535) { CheckListenPort(port + 1, addr, func); } else { if (func) { func(0); } } }
|
else { if (port < 65535) { CheckListenPort(port + 1, addr, func); } else { if (func) { func(0); } } }
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user