From b16c9f4b307505b0d963670145a4388ca5a556ba Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Sat, 14 Jan 2023 15:00:02 +0100 Subject: [PATCH] docs: Add more doc strings --- packages/moxxmpp/lib/src/reconnect.dart | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/moxxmpp/lib/src/reconnect.dart b/packages/moxxmpp/lib/src/reconnect.dart index b0fb236..5e80731 100644 --- a/packages/moxxmpp/lib/src/reconnect.dart +++ b/packages/moxxmpp/lib/src/reconnect.dart @@ -84,16 +84,21 @@ abstract class ReconnectionPolicy { /// A simple reconnection strategy: Make the reconnection delays exponentially longer /// for every failed attempt. +/// NOTE: This ReconnectionPolicy may be broken class ExponentialBackoffReconnectionPolicy extends ReconnectionPolicy { + ExponentialBackoffReconnectionPolicy(this._maxBackoffTime) : super(); - ExponentialBackoffReconnectionPolicy(this._maxBackoffTime) - : _counter = 0, - _log = Logger('ExponentialBackoffReconnectionPolicy'), - super(); + /// The maximum time in seconds that a backoff step should be. final int _maxBackoffTime; - int _counter; + + /// Amount of consecutive failed reconnections. + int _counter = 0; + + /// Backoff timer. Timer? _timer; - final Logger _log; + + /// Logger. + final Logger _log = Logger('ExponentialBackoffReconnectionPolicy'); /// Called when the backoff expired Future _onTimerElapsed() async { @@ -141,7 +146,7 @@ class ExponentialBackoffReconnectionPolicy extends ReconnectionPolicy { } } -/// A stub reconnection policy for tests +/// A stub reconnection policy for tests. @visibleForTesting class TestingReconnectionPolicy extends ReconnectionPolicy { TestingReconnectionPolicy() : super();