summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/connectionevents.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-03-09 22:48:00 +0100
committerGitHub <noreply@github.com>2023-03-09 22:48:00 +0100
commit08779c29099e8940493df56d28d8aa131ac8342e (patch)
tree7ad8ce25cf371e582137e1706dd671a6bf4342d0 /vendor/go.mau.fi/whatsmeow/connectionevents.go
parentd5f9cdf912d43cd2a5cb243e086fbdab9a9073b0 (diff)
downloadmatterbridge-msglm-08779c29099e8940493df56d28d8aa131ac8342e.tar.gz
matterbridge-msglm-08779c29099e8940493df56d28d8aa131ac8342e.tar.bz2
matterbridge-msglm-08779c29099e8940493df56d28d8aa131ac8342e.zip
Update dependencies (#2007)
* Update dependencies
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/connectionevents.go')
-rw-r--r--vendor/go.mau.fi/whatsmeow/connectionevents.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/connectionevents.go b/vendor/go.mau.fi/whatsmeow/connectionevents.go
index 5d0835fa..3a6d9e29 100644
--- a/vendor/go.mau.fi/whatsmeow/connectionevents.go
+++ b/vendor/go.mau.fi/whatsmeow/connectionevents.go
@@ -79,7 +79,10 @@ func (cli *Client) handleIB(node *waBinary.Node) {
func (cli *Client) handleConnectFailure(node *waBinary.Node) {
ag := node.AttrGetter()
reason := events.ConnectFailureReason(ag.Int("reason"))
- cli.expectDisconnect()
+ // Let the auto-reconnect happen for 503s, for all other failures block it
+ if reason != events.ConnectFailureServiceUnavailable {
+ cli.expectDisconnect()
+ }
if reason.IsLoggedOut() {
cli.Log.Infof("Got %s connect failure, sending LoggedOut event and deleting session", reason)
go cli.dispatchEvent(&events.LoggedOut{OnConnect: true, Reason: reason})
@@ -96,6 +99,8 @@ func (cli *Client) handleConnectFailure(node *waBinary.Node) {
} else if reason == events.ConnectFailureClientOutdated {
cli.Log.Errorf("Client outdated (405) connect failure")
go cli.dispatchEvent(&events.ClientOutdated{})
+ } else if reason == events.ConnectFailureServiceUnavailable {
+ cli.Log.Warnf("Got 503 connect failure, assuming automatic reconnect will handle it")
} else {
cli.Log.Warnf("Unknown connect failure: %s", node.XMLString())
go cli.dispatchEvent(&events.ConnectFailure{Reason: reason, Raw: node})