From 04f57d0a33e33eb284fa5c17a4ade448bdb5f12a Mon Sep 17 00:00:00 2001 From: mzz2017 <2017@duck.com> Date: Sun, 8 Sep 2024 22:09:31 +0800 Subject: [PATCH] test: add logs for debug --- component/outbound/dialer/connectivity_check.go | 13 +++++++++++++ component/outbound/dialer/dialer.go | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/component/outbound/dialer/connectivity_check.go b/component/outbound/dialer/connectivity_check.go index 9e478a6666..4d330e38b3 100644 --- a/component/outbound/dialer/connectivity_check.go +++ b/component/outbound/dialer/connectivity_check.go @@ -19,6 +19,7 @@ import ( "strings" "sync" "time" + "unsafe" "github.com/daeuniverse/dae/common" @@ -452,6 +453,18 @@ func (d *Dialer) aliveBackground() { } } }() + var unused int + for _, opt := range CheckOpts { + if len(d.mustGetCollection(opt.networkType).AliveDialerSetSet) == 0 { + unused++ + } + } + if unused == len(CheckOpts) { + d.Log.WithField("dialer", d.Property().Name). + WithField("p", unsafe.Pointer(d)). + Traceln("cleaned up due to unused") + return + } var wg sync.WaitGroup for range d.checkCh { for _, opt := range CheckOpts { diff --git a/component/outbound/dialer/dialer.go b/component/outbound/dialer/dialer.go index b2188190da..5be577cec0 100644 --- a/component/outbound/dialer/dialer.go +++ b/component/outbound/dialer/dialer.go @@ -10,6 +10,7 @@ import ( "fmt" "sync" "time" + "unsafe" "github.com/daeuniverse/dae/common" "github.com/daeuniverse/dae/config" @@ -97,6 +98,9 @@ func NewDialer(dialer netproxy.Dialer, option *GlobalOption, iOption InstanceOpt ctx: ctx, cancel: cancel, } + option.Log.WithField("dialer", d.Property().Name). + WithField("p", unsafe.Pointer(d)). + Traceln("NewDialer") return d }