diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-07-13 23:25:32 +0900 |
|---|---|---|
| committer | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-07-13 23:25:32 +0900 |
| commit | aec7d534141e66d69f83bbd4f150821b047ff038 (patch) | |
| tree | af4919910c753e9312c6b2c8e79b5951c6535455 /src | |
| parent | Update log message (diff) | |
| download | sharkey-aec7d534141e66d69f83bbd4f150821b047ff038.tar.gz sharkey-aec7d534141e66d69f83bbd4f150821b047ff038.tar.bz2 sharkey-aec7d534141e66d69f83bbd4f150821b047ff038.zip | |
Fix port cehcking
Diffstat (limited to 'src')
| -rw-r--r-- | src/index.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/index.ts b/src/index.ts index a700441ea5..c5f5d32e57 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ import * as os from 'os'; import * as cluster from 'cluster'; import * as debug from 'debug'; import chalk from 'chalk'; -// import portUsed = require('tcp-port-used'); +import * as portscanner from 'portscanner'; import isRoot = require('is-root'); import Xev from 'xev'; @@ -125,12 +125,9 @@ async function init(): Promise<Config> { throw 'You need root privileges to listen on port below 1024 on Linux'; } - // Check if a port is being used - /* https://github.com/stdarg/tcp-port-used/issues/3 - if (await portUsed.check(config.port)) { - throw `Port ${config.port} is already used`; + if (await portscanner.checkPortStatus(config.port, '127.0.0.1') === 'open') { + throw `Port ${config.port} is already in use`; } - */ // Try to connect to MongoDB const mongoDBLogger = new Logger('MongoDB'); |