Commit bcbce348 authored by Marten Seemann's avatar Marten Seemann

fix staticcheck

parent 0b84e304
......@@ -9,7 +9,7 @@ import (
)
func randomConns(tb testing.TB) (c [5000]network.Conn) {
for i, _ := range c {
for i := range c {
c[i] = randConn(tb, nil)
}
return c
......
......@@ -286,10 +286,8 @@ func (cm *BasicConnMgr) trim() {
}
// do the actual trim.
defer log.EventBegin(cm.ctx, "connCleanup").Done()
for _, c := range cm.getConnsToClose() {
log.Info("closing conn: ", c.RemotePeer())
log.Event(cm.ctx, "closeConn", c.RemotePeer())
c.Close()
}
......
......@@ -611,7 +611,6 @@ func TestPeerProtectionMultipleTags(t *testing.T) {
// add 2 more connections, sending the connection manager overboard again.
for i := 0; i < 2; i++ {
rc := randConn(t, not.Disconnected)
conns = append(conns, rc)
not.Connected(nil, rc)
cm.TagPeer(rc.RemotePeer(), "test", 20)
}
......@@ -631,7 +630,6 @@ func TestPeerProtectionMultipleTags(t *testing.T) {
// add 2 more connections, sending the connection manager overboard again.
for i := 0; i < 2; i++ {
rc := randConn(t, not.Disconnected)
conns = append(conns, rc)
not.Connected(nil, rc)
cm.TagPeer(rc.RemotePeer(), "test", 20)
}
......
......@@ -101,8 +101,7 @@ func (d *decayer) RegisterDecayingTag(name string, interval time.Duration, decay
d.tagsMu.Lock()
defer d.tagsMu.Unlock()
tag, ok := d.knownTags[name]
if ok {
if _, ok := d.knownTags[name]; ok {
return nil, fmt.Errorf("decaying tag with name %s already exists", name)
}
......@@ -118,7 +117,7 @@ func (d *decayer) RegisterDecayingTag(name string, interval time.Duration, decay
}
lastTick := d.lastTick.Load().(time.Time)
tag = &decayingTag{
tag := &decayingTag{
trkr: d,
name: name,
interval: interval,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment