diff options
author | Wim <wim@42.be> | 2022-08-13 16:14:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-13 16:14:26 +0200 |
commit | 6a3fc713978a0c1c9290a4afd08b47886b49b635 (patch) | |
tree | aa62cd85cf5671646c75ee38b3fc140ef7edcea8 /vendor/go.mau.fi/whatsmeow/request.go | |
parent | 3c4192ebf6a32e30cdd23a9644c2ceca72a006fa (diff) | |
download | matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.gz matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.tar.bz2 matterbridge-msglm-6a3fc713978a0c1c9290a4afd08b47886b49b635.zip |
Update dependencies and go1.18 (#1873)
* Update dependencies and go1.18
* Exclude unnecessary linters and update build to go1.18
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/request.go')
-rw-r--r-- | vendor/go.mau.fi/whatsmeow/request.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/request.go b/vendor/go.mau.fi/whatsmeow/request.go index e070126b..6945fd7b 100644 --- a/vendor/go.mau.fi/whatsmeow/request.go +++ b/vendor/go.mau.fi/whatsmeow/request.go @@ -201,17 +201,17 @@ func (cli *Client) retryFrame(reqType, id string, data []byte, origResp *waBinar return nil, err } var resp *waBinary.Node - if ctx != nil && timeout > 0 { - select { - case resp = <-respChan: - case <-ctx.Done(): - return nil, ctx.Err() - case <-time.After(timeout): - // FIXME this error isn't technically correct (but works for now - the ctx and timeout params are only used from sendIQ) - return nil, ErrIQTimedOut - } - } else { - resp = <-respChan + timeoutChan := make(<-chan time.Time, 1) + if timeout > 0 { + timeoutChan = time.After(timeout) + } + select { + case resp = <-respChan: + case <-ctx.Done(): + return nil, ctx.Err() + case <-timeoutChan: + // FIXME this error isn't technically correct (but works for now - the timeout param is only used from sendIQ) + return nil, ErrIQTimedOut } if isDisconnectNode(resp) { cli.Log.Debugf("Retrying %s %s was interrupted by websocket disconnection (%v), not retrying anymore", reqType, id, resp.XMLString()) |