From d695edcbf9ed22e60a963a079b3199d6897c2e89 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 29 Jul 2019 17:49:43 -0700 Subject: [PATCH] chore: fix bad merge --- connmgr.go | 2 +- connmgr_test.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/connmgr.go b/connmgr.go index b5c1d4d..6cfd561 100644 --- a/connmgr.go +++ b/connmgr.go @@ -246,7 +246,7 @@ func (cm *BasicConnMgr) getConnsToClose(ctx context.Context) []network.Conn { cm.plk.RUnlock() if ncandidates < cm.lowWater { - log.Info("open connection count above limit but too many are in the grace period") + cm.logger.Info("open connection count above limit but too many are in the grace period") // We have too many connections but fewer than lowWater // connections out of the grace period. // diff --git a/connmgr_test.go b/connmgr_test.go index 3721cef..6fa1cf1 100644 --- a/connmgr_test.go +++ b/connmgr_test.go @@ -14,7 +14,6 @@ import ( tu "github.com/libp2p/go-libp2p-core/test" ma "github.com/multiformats/go-multiaddr" "go.uber.org/zap/zaptest" - ) type tconn struct { @@ -50,7 +49,7 @@ func randConn(t testing.TB, discNotify func(network.Network, network.Conn)) netw return &tconn{peer: pid, disconnectNotify: discNotify} } - func TestConnTrimming(t *testing.T) { +func TestConnTrimming(t *testing.T) { wg := &sync.WaitGroup{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -334,9 +333,11 @@ func TestGracePeriod(t *testing.T) { if detectrace.WithRace() { t.Skip("race detector is unhappy with this test") } - + wg := &sync.WaitGroup{} + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() SilencePeriod = 0 - cm := NewConnManager(10, 20, 100*time.Millisecond) + cm := NewConnManager(ctx, wg, zaptest.NewLogger(t), 10, 20, 100*time.Millisecond) SilencePeriod = 10 * time.Second not := cm.Notifee() @@ -706,7 +707,7 @@ func TestTemporaryEntryConvertedOnConnection(t *testing.T) { wg := &sync.WaitGroup{} ctx, cancel := context.WithCancel(context.Background()) defer cancel() - cm := NewConnManager(ctx, wg,zaptest.NewLogger(t), 1, 1, 0) + cm := NewConnManager(ctx, wg, zaptest.NewLogger(t), 1, 1, 0) conn := randConn(t, nil) cm.TagPeer(conn.RemotePeer(), "test", 20)