From 035f0db6981f9db2aa515268fafdae6b7b90138b Mon Sep 17 00:00:00 2001 From: Makonike Date: Tue, 5 Sep 2023 20:09:45 +0800 Subject: [PATCH] fix: use anonymous member --- dtmsvr/utils.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/dtmsvr/utils.go b/dtmsvr/utils.go index fdf7d81..d83e092 100644 --- a/dtmsvr/utils.go +++ b/dtmsvr/utils.go @@ -53,7 +53,7 @@ func GetTransGlobal(gid string) *TransGlobal { } type asyncCtx struct { - parent context.Context + context.Context } func (a *asyncCtx) Deadline() (deadline time.Time, ok bool) { @@ -64,19 +64,11 @@ func (a *asyncCtx) Done() <-chan struct{} { return nil } -func (a *asyncCtx) Err() error { - return a.parent.Err() -} - -func (a *asyncCtx) Value(key any) any { - return a.parent.Value(key) -} - // NewAsyncContext create a new async context // the context will not be canceled when the parent context is canceled func NewAsyncContext(ctx context.Context) context.Context { if ctx == nil { return nil } - return &asyncCtx{parent: ctx} + return &asyncCtx{Context: ctx} }