mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-11-07 12:52:54 -05:00
Improved some websocket error handling.
This commit is contained in:
@@ -98,7 +98,7 @@ module.exports.CreateRedirServer = function (parent, db, args, func) {
|
||||
function CheckListenPort(port, func) {
|
||||
var s = obj.net.createServer(function (socket) { });
|
||||
obj.tcpServer = s.listen(port, function () { s.close(function () { if (func) { func(port); } }); }).on("error", function (err) {
|
||||
if (args.exactports) { console.error("ERROR: MeshCentral HTTP web 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, func); } else { if (func) { func(0); } } }
|
||||
});
|
||||
}
|
||||
@@ -108,7 +108,7 @@ module.exports.CreateRedirServer = function (parent, db, args, func) {
|
||||
if (port == 0 || port == 65535) { return; }
|
||||
obj.tcpServer = obj.app.listen(port, function () {
|
||||
obj.port = port;
|
||||
console.log("MeshCentral HTTP redirection web server running on port " + port + ".");
|
||||
console.log("MeshCentral HTTP redirection server running on port " + port + ".");
|
||||
obj.parent.updateServerState("redirect-port", port);
|
||||
func(obj.port);
|
||||
}).on("error", function (err) {
|
||||
|
||||
Reference in New Issue
Block a user