package telegram
import (
"context"
"github.com/go-faster/errors"
"github.com/gotd/log"
"github.com/gotd/td/exchange"
"github.com/gotd/td/mtproto"
"github.com/gotd/td/pool"
)
func (c *Client ) handleCDNConnDead (dcID int , err error ) {
if errors .Is (err , exchange .ErrKeyFingerprintNotFound ) {
c .log .Warn (context .Background (), "Resetting cached CDN keys after fingerprint miss" ,
log .Int ("dc_id" , dcID ),
)
c .cdnKeysMux .Lock ()
c .cdnKeys = nil
c .cdnKeysByDC = nil
c .cdnKeysSet = false
c .cdnKeysGen ++
c .cdnKeysMux .Unlock ()
c .cdnKeysLoad .Forget (helpGetCDNConfigSingleflightKey )
c .cdnPools .invalidateDC (dcID )
return
}
if !errors .Is (err , mtproto .ErrPFSDropKeysRequired ) {
if c .onDead != nil {
c .onDead (err )
}
return
}
c .log .Warn (context .Background (), "Dropping stored CDN session key after PFS key reset request" ,
log .Int ("dc_id" , dcID ),
)
c .sessionsMux .Lock ()
s , ok := c .cdnSessions [dcID ]
if !ok {
s = pool .NewSyncSession (pool .Session {DC : dcID })
c .cdnSessions [dcID ] = s
}
s .Store (pool .Session {DC : dcID })
c .sessionsMux .Unlock ()
if c .onDead != nil {
c .onDead (err )
}
}
The pages are generated with Golds v0.8.4 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .