summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/mediaconn.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-04-01 00:23:19 +0200
committerGitHub <noreply@github.com>2022-04-01 00:23:19 +0200
commitc6716e030c02f316b887c1d3ee4b443aa3ab6afd (patch)
tree470461fe2d29662e7a69834ed21fce30beed65ab /vendor/go.mau.fi/whatsmeow/mediaconn.go
parent4ab72acec656dafd304f88359b509b1f27c06604 (diff)
downloadmatterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.tar.gz
matterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.tar.bz2
matterbridge-msglm-c6716e030c02f316b887c1d3ee4b443aa3ab6afd.zip
Update dependencies (#1784)
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/mediaconn.go')
-rw-r--r--vendor/go.mau.fi/whatsmeow/mediaconn.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/mediaconn.go b/vendor/go.mau.fi/whatsmeow/mediaconn.go
index 6faa27a6..2e833037 100644
--- a/vendor/go.mau.fi/whatsmeow/mediaconn.go
+++ b/vendor/go.mau.fi/whatsmeow/mediaconn.go
@@ -40,17 +40,17 @@ func (mc *MediaConn) Expiry() time.Time {
return mc.FetchedAt.Add(time.Duration(mc.TTL) * time.Second)
}
-func (cli *Client) refreshMediaConn(force bool) error {
+func (cli *Client) refreshMediaConn(force bool) (*MediaConn, error) {
cli.mediaConnLock.Lock()
defer cli.mediaConnLock.Unlock()
- if cli.mediaConn == nil || force || time.Now().After(cli.mediaConn.Expiry()) {
+ if cli.mediaConnCache == nil || force || time.Now().After(cli.mediaConnCache.Expiry()) {
var err error
- cli.mediaConn, err = cli.queryMediaConn()
+ cli.mediaConnCache, err = cli.queryMediaConn()
if err != nil {
- return err
+ return nil, err
}
}
- return nil
+ return cli.mediaConnCache, nil
}
func (cli *Client) queryMediaConn() (*MediaConn, error) {