feat(xep): Ignore the ack timer if we are receiving data
This commit is contained in:
parent
e7922668b1
commit
1f712151e4
@ -77,7 +77,13 @@ class StreamManagementManager extends XmppManagerBase {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onData() async {
|
Future<void> onData() async {
|
||||||
logger.finest('Got data!');
|
// The ack timer does not matter if we are currently in the middle of receiving
|
||||||
|
// data.
|
||||||
|
await _ackLock.synchronized(() {
|
||||||
|
if (_pendingAcks > 0) {
|
||||||
|
_resetAckTimer();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when a stanza has been acked to decide whether we should trigger a
|
/// Called when a stanza has been acked to decide whether we should trigger a
|
||||||
@ -230,6 +236,12 @@ class StreamManagementManager extends XmppManagerBase {
|
|||||||
_ackTimer = null;
|
_ackTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Resets the ack timer.
|
||||||
|
void _resetAckTimer() {
|
||||||
|
_stopAckTimer();
|
||||||
|
_startAckTimer();
|
||||||
|
}
|
||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
Future<void> handleAckTimeout() async {
|
Future<void> handleAckTimeout() async {
|
||||||
_stopAckTimer();
|
_stopAckTimer();
|
||||||
@ -320,8 +332,7 @@ class StreamManagementManager extends XmppManagerBase {
|
|||||||
|
|
||||||
// Reset the timer
|
// Reset the timer
|
||||||
if (_pendingAcks > 0) {
|
if (_pendingAcks > 0) {
|
||||||
_stopAckTimer();
|
_resetAckTimer();
|
||||||
_startAckTimer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user