Reduce frequency of port scanning
This commit is contained in:
parent
03ad2a17b2
commit
91deaece47
@ -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}.`);
|
||||||
|
Loading…
Reference in New Issue
Block a user