Skip to content

Commit

Permalink
fix context leak in timeout chain element
Browse files Browse the repository at this point in the history
Signed-off-by: NikitaSkrynnik <nikita.skrynnik@xored.com>
  • Loading branch information
NikitaSkrynnik committed Oct 14, 2024
1 parent 76b397f commit 7221c8c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/networkservice/common/timeout/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ func (s *timeoutServer) Request(ctx context.Context, request *networkservice.Net
afterCh := timeClock.After(timeClock.Until(expirationTime) - requestTimeout)

go func(cancelCtx context.Context, afterCh <-chan time.Time) {
defer cancel()
select {
case <-cancelCtx.Done():
case <-afterCh:
eventFactory.Close(begin.CancelContext(cancelCtx))
<-eventFactory.Close(begin.CancelContext(cancelCtx))
}
}(cancelCtx, afterCh)

Expand Down

0 comments on commit 7221c8c

Please sign in to comment.