Reduce frequency of port scanning

This commit is contained in:
Asher 2019-03-29 16:14:28 -05:00
parent 03ad2a17b2
commit 91deaece47
No known key found for this signature in database
GPG Key ID: 7BB4BA9C783D2BBC
1 changed files with 2 additions and 1 deletions

View File

@ -17,7 +17,7 @@ export interface PortScanner {
* Will scan local ports and emit events when ports are added or removed. * Will scan local ports and emit events when ports are added or removed.
* Currently only scans TCP ports. * Currently only scans TCP ports.
*/ */
export const createPortScanner = (scanInterval: number = 250): PortScanner => { export const createPortScanner = (scanInterval: number = 5000): PortScanner => {
const ports = new Map<number, number>(); const ports = new Map<number, number>();
const addEmitter = new Emitter<number[]>(); const addEmitter = new Emitter<number[]>();
@ -76,6 +76,7 @@ export const createPortScanner = (scanInterval: number = 250): PortScanner => {
let disposed: boolean = false; let disposed: boolean = false;
const doInterval = (): void => { const doInterval = (): void => {
logger.trace("scanning ports");
scan((error) => { scan((error) => {
if (error) { if (error) {
logger.error(`Port scanning will not be available: ${error.message}.`); logger.error(`Port scanning will not be available: ${error.message}.`);