mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
remove event listeners on timeout
This commit is contained in:
parent
95107eb2eb
commit
8695474d04
1 changed files with 9 additions and 0 deletions
|
|
@ -1433,6 +1433,9 @@ class Connection extends EventEmitter {
|
|||
// reject login request as timed out after estimated delay, plus a bit extra
|
||||
const estTimeout = response.estTimeout + extraTimeoutMillis;
|
||||
timeoutHandler = setTimeout(() => {
|
||||
this.off(Constants.ResponseCodes.Err, onErr);
|
||||
this.off(Constants.ResponseCodes.Sent, onSent);
|
||||
this.off(Constants.PushCodes.LoginSuccess, onLoginSuccess);
|
||||
reject("timeout");
|
||||
}, estTimeout);
|
||||
|
||||
|
|
@ -1496,6 +1499,9 @@ class Connection extends EventEmitter {
|
|||
// reject login request as timed out after estimated delay, plus a bit extra
|
||||
const estTimeout = response.estTimeout + extraTimeoutMillis;
|
||||
timeoutHandler = setTimeout(() => {
|
||||
this.off(Constants.ResponseCodes.Err, onErr);
|
||||
this.off(Constants.ResponseCodes.Sent, onSent);
|
||||
this.off(Constants.PushCodes.StatusResponse, onStatusResponsePush);
|
||||
reject("timeout");
|
||||
}, estTimeout);
|
||||
|
||||
|
|
@ -1581,6 +1587,9 @@ class Connection extends EventEmitter {
|
|||
// reject as timed out after estimated delay, plus a bit extra
|
||||
const estTimeout = response.estTimeout + extraTimeoutMillis;
|
||||
timeoutHandler = setTimeout(() => {
|
||||
this.off(Constants.ResponseCodes.Err, onErr);
|
||||
this.off(Constants.ResponseCodes.Sent, onSent);
|
||||
this.off(Constants.PushCodes.TelemetryResponse, onTelemetryResponsePush);
|
||||
reject("timeout");
|
||||
}, estTimeout);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue