lib/stun: Inline util.OnDone, comment on its purpose (#7308)

Co-authored-by: greatroar <@>
This commit is contained in:
greatroar
2021-01-27 19:27:00 +01:00
committed by GitHub
co-authored by greatroar <@>
parent e19d6e993d
commit 8b86171642
2 changed files with 6 additions and 9 deletions
-8
View File
@@ -250,14 +250,6 @@ func AddressUnspecifiedLess(a, b net.Addr) bool {
return aIsUnspecified
}
// OnDone calls fn when ctx is cancelled.
func OnDone(ctx context.Context, fn func()) {
go func() {
<-ctx.Done()
fn()
}()
}
func CallWithContext(ctx context.Context, fn func() error) error {
var err error
done := make(chan struct{})