Browse Source

if we get a 401, stop trying to connect

This can happen if someone tries to use revoked persistent session
credentials. Currently, we just hammer WA's servers trying to retry,
which is bad.
master
eta 4 years ago
parent
commit
341d1730fb
  1. 9
      src/whatsapp.rs

9
src/whatsapp.rs

@ -678,6 +678,15 @@ impl WhatsappManager { @@ -678,6 +678,15 @@ impl WhatsappManager {
self.conn.disable();
}
}
if let WaError::StatusCode(sc) = err {
if sc == 401 {
warn!("Disconnected from WhatsApp due to 401");
let err = "Error: WhatsApp Web credentials are invalid. Use the WHATSAPP SETUP command to restore connectivity.";
self.cb_tx.unbounded_send(ControlBotCommand::ReportFailure(err.into()))
.unwrap();
self.conn.disable();
}
}
self.our_jid = None;
self.connected = false;
}

Loading…
Cancel
Save