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

View File

@ -161,6 +161,7 @@ xo.on('started', function () {
// } // }
// http_servers.forEach(function (http_server) { // http_servers.forEach(function (http_server) {
// http_server.on('connection', function () {
// new WSServer({ // new WSServer({
// 'server': http_server, // 'server': http_server,
// 'path': '/websockify', // 'path': '/websockify',
@ -168,6 +169,7 @@ xo.on('started', function () {
// .on('connection', on_connection); // .on('connection', on_connection);
// }); // });
// }); // });
// });
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// JSON-RPC over WebSocket. // JSON-RPC over WebSocket.
@ -198,12 +200,14 @@ xo.on('started', function () {
} }
http_servers.forEach(function (http_server) { http_servers.forEach(function (http_server) {
http_server.on('connection', function () {
new WSServer({ new WSServer({
'server': http_server, 'server': http_server,
'path': '/api/', 'path': '/api/',
}).on('connection', on_connection); }).on('connection', on_connection);
}); });
}); });
});
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// JSON-RPC over TCP. // JSON-RPC over TCP.
@ -380,7 +384,13 @@ read_file(__dirname +'/../config/local.yaml').then(
require('http').createServer().listen(port, host) require('http').createServer().listen(port, host)
.on('listening', function () { .on('listening', function () {
console.info( 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 host, port
); );
}) })
@ -402,7 +412,12 @@ read_file(__dirname +'/../config/local.yaml').then(
'key': key, 'key': key,
}).listen(port, host).on('listening', function () { }).listen(port, host).on('listening', function () {
console.info( 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 host, port
); );
}) })