func (c *Client) SetAuth(dbId uint8) { if c != nil && c.authEnabled { c.mtx.Lock() if c.authBM == nil { c.authBM = util.NewBitMap(256 / 8) } c.authBM.Set(uint(dbId)) c.mtx.Unlock() } }
// Cache authorize result. When authorizing again, return directly. func (c *Client) cachAuth(pkg []byte) { var one proto.PkgOneOp _, err := one.Decode(pkg) if err == nil && one.ErrCode == 0 { c.mtx.Lock() if c.authBM == nil { c.authBM = util.NewBitMap(256 / 8) } c.authBM.Set(uint(one.DbId)) c.mtx.Unlock() } }