From 873c9d5e69f8107a1895d76bcdca1f21e3a4acde Mon Sep 17 00:00:00 2001 From: SunBK201 Date: Sat, 6 Dec 2025 23:19:36 +0800 Subject: [PATCH] fix: ensure start time is set for new connection records --- src/internal/statistics/conn.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/internal/statistics/conn.go b/src/internal/statistics/conn.go index 0a21321..1ef77e8 100644 --- a/src/internal/statistics/conn.go +++ b/src/internal/statistics/conn.go @@ -62,11 +62,15 @@ func (l *ConnectionRecordList) Add(record *ConnectionRecord) { if r, exists := l.records[key]; exists { r.Protocol = record.Protocol } else { + startTime := record.StartTime + if startTime.IsZero() { + startTime = time.Now() + } l.records[key] = &ConnectionRecord{ Protocol: record.Protocol, SrcAddr: record.SrcAddr, DestAddr: record.DestAddr, - StartTime: record.StartTime, + StartTime: startTime, } } }