fix #157: catch EADDRINUSE to prevent endless restarts if the port is already in use

This commit is contained in:
schlagmichdoch 2023-09-19 17:53:21 +02:00
parent d77ccdf233
commit e807c3959a

View file

@ -124,6 +124,14 @@ if (process.argv.includes('--localhost-only')) {
server.listen(port); server.listen(port);
} }
server.on('error', (err) => {
if (err.code === 'EADDRINUSE') {
console.error(err);
console.info("Error EADDRINUSE received, exiting process without restarting process...");
process.exit(0)
}
});
class PairDropServer { class PairDropServer {
constructor() { constructor() {