mirror of
https://github.com/vale981/autossh
synced 2025-03-04 17:01:41 -05:00
rename debounce to poll
This commit is contained in:
parent
09fb0c6e3a
commit
7e0ad0c549
1 changed files with 4 additions and 5 deletions
|
@ -34,7 +34,7 @@ class AutoSSH extends EventEmitter {
|
|||
this.localPort = freePort;
|
||||
|
||||
this.execTunnel(() => {
|
||||
this.debounceConnection(() => {
|
||||
this.pollConnection(() => {
|
||||
this.emit('connect', {
|
||||
kill: this.kill,
|
||||
pid: this.currentProcess.pid,
|
||||
|
@ -53,19 +53,18 @@ class AutoSSH extends EventEmitter {
|
|||
});
|
||||
}
|
||||
|
||||
debounceConnection(cb) {
|
||||
pollConnection(cb) {
|
||||
if (this.pollCount >= this.maxPollCount) {
|
||||
this.emit('error', 'Max debounce count reached. Aborting...');
|
||||
this.emit('error', 'Max poll count reached. Aborting...');
|
||||
return this.kill();
|
||||
}
|
||||
|
||||
this.isConnectionEstablished(result => {
|
||||
if (result)
|
||||
return cb();
|
||||
console.log('Not Ready... Debounce!!!');
|
||||
setTimeout(() => {
|
||||
this.pollCount++;
|
||||
this.debounceConnection(cb);
|
||||
this.pollConnection(cb);
|
||||
}, this.pollTimeout);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue