mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Completed basic functionality development
This commit is contained in:
@@ -4,7 +4,7 @@ const { logger } = require("./filesystem")
|
||||
/** Checks if a port is already in use
|
||||
*
|
||||
*/
|
||||
function checkPort(port, callback) {
|
||||
function checkPortSync(port, callback) {
|
||||
portfinder.getPort({ port: port, stopPort: port }, (err, res) => {
|
||||
if (err !== null) {
|
||||
logger.error(`Port ${port} already in use`);
|
||||
@@ -15,6 +15,14 @@ function checkPort(port, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function checkPort(port) {
|
||||
return portfinder.getPortPromise({ port: port, stopPort: port });
|
||||
}
|
||||
|
||||
function getFreePort(startPort) {
|
||||
return portfinder.getPortPromise({ port: startPort });
|
||||
}
|
||||
|
||||
/** Performs a fetch request, with a configurable timeout
|
||||
*
|
||||
*/
|
||||
@@ -34,6 +42,8 @@ async function fetchWithTimeout(resource, options = {}) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getFreePort: getFreePort,
|
||||
checkPort: checkPort,
|
||||
checkPortSync: checkPortSync,
|
||||
fetchWithTimeout: fetchWithTimeout
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user