Skip to content

Commit

Permalink
Add CloseChannelWithoutPanic function to mtproto.go
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarnathCJD committed Apr 29, 2024
1 parent 761494b commit 7209a61
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mtproto.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,3 +673,8 @@ func closeOnCancel(ctx context.Context, c io.Closer) {
c.Close()
}()
}

func CloseChannelWithoutPanic(ch chan tl.Object) {
defer func() { recover() }()
close(ch)
}

0 comments on commit 7209a61

Please sign in to comment.