chore: avoid return nil. fix #930

This commit is contained in:
Larvan2 2023-12-23 13:10:29 +08:00
parent b632575e39
commit 997663a4ad

View File

@ -76,11 +76,10 @@ func (p *Proxy) ListenPacketContext(ctx context.Context, metadata *C.Metadata, o
// DelayHistory implements C.Proxy
func (p *Proxy) DelayHistory() []C.DelayHistory {
queueM := p.history.Copy()
var histories []C.DelayHistory
histories := []C.DelayHistory{}
for _, item := range queueM {
histories = append(histories, item)
}
return histories
}
@ -91,8 +90,7 @@ func (p *Proxy) DelayHistoryForTestUrl(url string) []C.DelayHistory {
if state, ok := p.extra.Load(url); ok {
queueM = state.history.Copy()
}
var histories []C.DelayHistory
histories := []C.DelayHistory{}
for _, item := range queueM {
histories = append(histories, item)
}