#pragma once #include namespace roro { // Waits between IRC reconnection attempts: 5 s, 10 s, 30 s, 1 min, 2 min, then every 5 min. class ReconnectPolicy { public: uint32_t nextDelayMs() { static const uint32_t kDelays[] = {5000, 10000, 30000, 60000, 120000, 300000}; const int n = sizeof(kDelays) / sizeof(kDelays[0]); return kDelays[attempt_ < n ? attempt_++ : n - 1]; } void reset() { attempt_ = 0; } private: int attempt_ = 0; }; } // namespace roro