aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreta <hi@theta.eu.org>2019-10-05 10:52:43 +0100
committereta <hi@theta.eu.org>2019-10-05 10:52:43 +0100
commit341d1730fb6c8509a9e1560b3eec4eca6c417a3c (patch)
tree2a6e523981be38de57a5de1f21c9e8a6df6b3160
parent2b69256bdc4b7157b4ac1c5ab60181e7f3ad6d87 (diff)
downloadsms-irc-341d1730fb6c8509a9e1560b3eec4eca6c417a3c.tar.gz
sms-irc-341d1730fb6c8509a9e1560b3eec4eca6c417a3c.tar.bz2
sms-irc-341d1730fb6c8509a9e1560b3eec4eca6c417a3c.zip
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.
-rw-r--r--src/whatsapp.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/whatsapp.rs b/src/whatsapp.rs
index bed72a1..285caeb 100644
--- a/src/whatsapp.rs
+++ b/src/whatsapp.rs
@@ -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;
}