Skip to content

Commit

Permalink
fix(dcpool): invalid takeout caused by double lock
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Oct 3, 2024
1 parent c874919 commit ec66ab1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/dcpool/dcpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ func (p *pool) current() int {
}

func (p *pool) Client(ctx context.Context, dc int) *tg.Client {
p.mu.Lock()
defer p.mu.Unlock()

return tg.NewClient(p.invoker(ctx, dc))
}

func (p *pool) invoker(ctx context.Context, dc int) tg.Invoker {
p.mu.Lock()
defer p.mu.Unlock()

if i, ok := p.invokers[dc]; ok {
return i
}
Expand Down

0 comments on commit ec66ab1

Please sign in to comment.