package telegram
import (
"context"
"github.com/go-faster/errors"
"github.com/gotd/log"
"github.com/gotd/td/mtproto"
"github.com/gotd/td/pool"
)
func (c *Client ) handlePrimaryConnDead (err error ) {
if !errors .Is (err , mtproto .ErrPFSDropKeysRequired ) {
return
}
dc := c .session .Load ().DC
c .log .Warn (context .Background (), "Dropping stored primary session key after PFS key reset request" ,
log .Int ("dc_id" , dc ),
)
c .session .Store (pool .Session {DC : dc })
c .sessionsMux .Lock ()
if s , ok := c .sessions [dc ]; ok {
s .Store (pool .Session {DC : dc })
}
c .sessionsMux .Unlock ()
}
func (c *Client ) handleDCConnDead (dcID int , err error ) {
if !errors .Is (err , mtproto .ErrPFSDropKeysRequired ) {
if c .onDead != nil {
c .onDead (err )
}
return
}
c .log .Warn (context .Background (), "Dropping stored DC session key after PFS key reset request" ,
log .Int ("dc_id" , dcID ),
)
c .sessionsMux .Lock ()
s , ok := c .sessions [dcID ]
if !ok {
s = pool .NewSyncSession (pool .Session {DC : dcID })
c .sessions [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 .