Fix low balance self limiting
The second if statement had an inverted argument that would cause low
balance limiting to turn off and on each cycle of the exit manager loop
@@ -411,11 +411,10 @@ impl Handler<Tick> for ExitManager {
// Self limit bandwidth consumption if we have a low balance
let free_tier_throughput = SETTING.get_payment().free_tier_throughput;
if self.last_exit.is_some() && low_balance() && !self.local_limiting {
- // TODO send notification to user via sms
warn!("Balance is low! sending notification and limiting usage");
let _ = KI.set_classless_limit("wg_exit", free_tier_throughput);
self.local_limiting = true;
- } else if self.last_exit.is_some() && low_balance() && self.local_limiting {
+ } else if self.last_exit.is_some() && !low_balance() && self.local_limiting {
info!("Balance is above the payment level, removing local limits");
let _ = KI.delete_qdisc("wg_exit");
self.local_limiting = false;
