mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-05 17:33:49 +00:00
fix #157: catch EADDRINUSE to prevent endless restarts if the port is already in use
This commit is contained in:
8
index.js
8
index.js
@@ -124,6 +124,14 @@ if (process.argv.includes('--localhost-only')) {
|
||||
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 {
|
||||
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user