Skip to content

Commit

Permalink
Move remove listener to the _cancelResume method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Romick2005 committed Apr 16, 2024
1 parent e9d036e commit ee632d4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions modules/xmpp/ResumeTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ export default class ResumeTask {
this._cancelResume();

this._resumeRetryN += 1;
if (this._networkOnlineListener) {
this._networkOnlineListener();
}

this._networkOnlineListener
= NetworkInfo.addCancellableListener(
NETWORK_INFO_EVENT,
Expand Down Expand Up @@ -100,6 +98,11 @@ export default class ResumeTask {
* @returns {void}
*/
_cancelResume() {
if (this._networkOnlineListener) {
this._networkOnlineListener();
this._networkOnlineListener = null;
}

if (this._resumeTimeout) {
logger.info('Canceling connection resume task');
clearTimeout(this._resumeTimeout);
Expand Down Expand Up @@ -155,9 +158,5 @@ export default class ResumeTask {
cancel() {
this._cancelResume();
this._resumeRetryN = 0;
if (this._networkOnlineListener) {
this._networkOnlineListener();
this._networkOnlineListener = null;
}
}
}

0 comments on commit ee632d4

Please sign in to comment.