without cancel the context
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/go-gost/core/logger"
|
||||
"github.com/go-gost/core/metadata"
|
||||
xctx "github.com/go-gost/x/ctx"
|
||||
xrecorder "github.com/go-gost/x/recorder"
|
||||
)
|
||||
|
||||
@@ -53,28 +52,3 @@ func RecorderObjectFromContext(ctx context.Context) *xrecorder.HandlerRecorderOb
|
||||
v, _ := ctx.Value(recorderObjectCtxKey{}).(*xrecorder.HandlerRecorderObject)
|
||||
return v
|
||||
}
|
||||
|
||||
func Copy(ctx context.Context) context.Context {
|
||||
if ctx == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
ctx2 := context.Background()
|
||||
if v := xctx.SrcAddrFromContext(ctx); v != nil {
|
||||
ctx2 = xctx.ContextWithSrcAddr(ctx2, v)
|
||||
}
|
||||
if v := xctx.DstAddrFromContext(ctx); v != nil {
|
||||
ctx2 = xctx.ContextWithDstAddr(ctx2, v)
|
||||
}
|
||||
if v := xctx.SidFromContext(ctx); v != "" {
|
||||
ctx2 = xctx.ContextWithSid(ctx2, v)
|
||||
}
|
||||
if v := xctx.ClientIDFromContext(ctx); v != "" {
|
||||
ctx2 = xctx.ContextWithClientID(ctx2, v)
|
||||
}
|
||||
if v := MetadataFromContext(ctx); v != nil {
|
||||
ctx2 = ContextWithMetadata(ctx2, v)
|
||||
}
|
||||
|
||||
return ctx2
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user