From 6a3fc713978a0c1c9290a4afd08b47886b49b635 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 13 Aug 2022 16:14:26 +0200 Subject: Update dependencies and go1.18 (#1873) * Update dependencies and go1.18 * Exclude unnecessary linters and update build to go1.18 --- vendor/go.mau.fi/whatsmeow/request.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'vendor/go.mau.fi/whatsmeow/request.go') 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()) -- cgit v1.2.3