Display an error message when the HTTP(S) server could not start.

This commit is contained in:
Julien Fontanet 2013-10-30 12:21:10 +01:00
parent ac39e3b98e
commit e69db958b2
1 changed files with 26 additions and 11 deletions

View File

@ -161,11 +161,13 @@ xo.on('started', function () {
// }
// http_servers.forEach(function (http_server) {
// new WSServer({
// 'server': http_server,
// 'path': '/websockify',
// })
// .on('connection', on_connection);
// http_server.on('connection', function () {
// new WSServer({
// 'server': http_server,
// 'path': '/websockify',
// })
// .on('connection', on_connection);
// });
// });
// });
@ -198,10 +200,12 @@ xo.on('started', function () {
}
http_servers.forEach(function (http_server) {
new WSServer({
'server': http_server,
'path': '/api/',
}).on('connection', on_connection);
http_server.on('connection', function () {
new WSServer({
'server': http_server,
'path': '/api/',
}).on('connection', on_connection);
});
});
});
@ -380,7 +384,13 @@ read_file(__dirname +'/../config/local.yaml').then(
require('http').createServer().listen(port, host)
.on('listening', function () {
console.info(
'XO-Server HTTP server is listening on %s:%s',
'HTTP server is listening on %s:%s',
host, port
);
})
.on('error', function () {
console.warn(
'[Warn] HTTP server could not listen on %s:%s',
host, port
);
})
@ -402,7 +412,12 @@ read_file(__dirname +'/../config/local.yaml').then(
'key': key,
}).listen(port, host).on('listening', function () {
console.info(
'XO-Server HTTPS server is listening on %s:%s',
'HTTPS server is listening on %s:%s',
host, port
);
}).on('error', function () {
console.warn(
'[Warn] HTTPS server could not listen on %s:%s',
host, port
);
})