Skip to content

Commit

Permalink
Make sure to not reconnect WA socket if OnConnect is true
Browse files Browse the repository at this point in the history
  • Loading branch information
javiercr committed May 30, 2024
1 parent cb9aab1 commit 6891459
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion user.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ func (user *User) e2eeEventHandler(rawEvt any) {
go user.sendMarkdownBridgeAlert(context.TODO(), "Error in WhatsApp connection: %s", evt.PermanentDisconnectDescription())
case events.PermanentDisconnect:
cf, ok := evt.(*events.LoggedOut)
if ok && cf.Reason == events.ConnectFailureLoggedOut && user.canReconnect() {
if ok && cf.Reason == events.ConnectFailureLoggedOut && !cf.OnConnect && user.canReconnect() {
user.WADevice = nil
user.log.Debug().Msg("Doing full reconnect after WhatsApp 401 error")
go user.FullReconnect()
Expand Down

0 comments on commit 6891459

Please sign in to comment.