mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Improved some websocket error handling.
This commit is contained in:
parent
d7b60ccb07
commit
8b60090e33
10 changed files with 45 additions and 37 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue