fix array allocation

This commit is contained in:
Vladimir Stoilov
2022-09-20 23:08:44 +02:00
committed by Daniel
parent 0085d6a7ea
commit 57904426e3

View File

@@ -52,11 +52,9 @@ func (cs *connectionStore) list() []*Connection {
cs.rw.RLock()
defer cs.rw.RUnlock()
l := make([]*Connection, len(cs.items))
index := 0
l := make([]*Connection, 0, len(cs.items))
for _, conn := range cs.items {
l[index] = conn
index++
l = append(l, conn)
}
return l
}