mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 15:26:17 -04:00
fix #157: catch EADDRINUSE to prevent endless restarts if the port is already in use
This commit is contained in:
parent
d77ccdf233
commit
e807c3959a
1 changed files with 8 additions and 0 deletions
8
index.js
8
index.js
|
@ -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() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue