mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-24 14:34:12 +01:00
Update go-whatsapp
This commit is contained in:
parent
e6045a3cf5
commit
ba0ec021ba
5 changed files with 8 additions and 4 deletions
|
@ -499,7 +499,7 @@ func (handler *CommandHandler) CommandReconnect(ce *CommandEvent) {
|
|||
ce.User.SetSession(&sess)
|
||||
}
|
||||
|
||||
err = ce.User.Conn.Restore()
|
||||
err = ce.User.Conn.Restore(true)
|
||||
if err == whatsapp.ErrInvalidSession {
|
||||
if ce.User.Session != nil {
|
||||
ce.User.log.Debugln("Got invalid session error when reconnecting, but user has session. Retrying using RestoreWithSession()...")
|
||||
|
|
2
go.mod
2
go.mod
|
@ -16,4 +16,4 @@ require (
|
|||
maunium.net/go/mautrix v0.8.2
|
||||
)
|
||||
|
||||
replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.3.20
|
||||
replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.3.21
|
||||
|
|
2
go.sum
2
go.sum
|
@ -143,6 +143,8 @@ github.com/tulir/go-whatsapp v0.3.19 h1:76VtmcjKGX8MbfJN9NNi1f0IVmigTLUcxqE1VRco
|
|||
github.com/tulir/go-whatsapp v0.3.19/go.mod h1:U5+sm33vrv3wz62YyRM/VS7q2ObXkxU4Xqj/3KOmN9o=
|
||||
github.com/tulir/go-whatsapp v0.3.20 h1:nK92MgruqXwk+QlaAS39xhzHNbFvJIEgUIOUrN3i8Yc=
|
||||
github.com/tulir/go-whatsapp v0.3.20/go.mod h1:U5+sm33vrv3wz62YyRM/VS7q2ObXkxU4Xqj/3KOmN9o=
|
||||
github.com/tulir/go-whatsapp v0.3.21 h1:2m7gUw4oHX4kIpMmP9VwCR7KEUK/PHhXLygPFGF9XfI=
|
||||
github.com/tulir/go-whatsapp v0.3.21/go.mod h1:U5+sm33vrv3wz62YyRM/VS7q2ObXkxU4Xqj/3KOmN9o=
|
||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
|
|
|
@ -201,7 +201,7 @@ func (prov *ProvisioningAPI) Reconnect(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
user.log.Debugln("Restoring session for /reconnect")
|
||||
err = user.Conn.Restore()
|
||||
err = user.Conn.Restore(true)
|
||||
user.log.Debugfln("Restore session for /reconnect responded with %v", err)
|
||||
if err == whatsapp.ErrInvalidSession {
|
||||
if user.Session != nil {
|
||||
|
|
4
user.go
4
user.go
|
@ -801,12 +801,14 @@ func (user *User) tryReconnect(msg string) {
|
|||
}
|
||||
delay := baseDelay
|
||||
conn := user.Conn
|
||||
takeover := false
|
||||
for user.ConnectionErrors <= user.bridge.Config.Bridge.MaxConnectionAttempts {
|
||||
if user.Conn != conn {
|
||||
user.log.Debugln("Connection was recreated, aborting reconnection attempts")
|
||||
return
|
||||
}
|
||||
err := conn.Restore()
|
||||
err := conn.Restore(takeover)
|
||||
takeover = true
|
||||
if err == nil {
|
||||
user.ConnectionErrors = 0
|
||||
if user.bridge.Config.Bridge.ReportConnectionRetry {
|
||||
|
|
Loading…
Reference in a new issue