From 581571b349ef023d232c893118309bb95895ea99 Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Wed, 23 Oct 2024 09:33:40 -0700 Subject: [PATCH] Nits --- p2p/host/basic/basic_host_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/p2p/host/basic/basic_host_test.go b/p2p/host/basic/basic_host_test.go index cbc58a7d09..2a7a772976 100644 --- a/p2p/host/basic/basic_host_test.go +++ b/p2p/host/basic/basic_host_test.go @@ -965,7 +965,8 @@ func TestHostTimeoutNewStream(t *testing.T) { assert.NoError(t, err) msgLen, varintN := binary.Uvarint(buf[:n]) - proto := buf[varintN : varintN+int(msgLen)] + buf = buf[varintN:] + proto := buf[:int(msgLen)] if string(proto) == "/ipfs/id/1.0.0\n" { // Signal we don't support identify na := []byte("na\n") @@ -977,15 +978,16 @@ func TestHostTimeoutNewStream(t *testing.T) { } else { // Stall time.Sleep(5 * time.Second) - t.Log("Resetting") } + t.Log("Resetting") s.Reset() }) - h1.Connect(context.Background(), peer.AddrInfo{ + err = h1.Connect(context.Background(), peer.AddrInfo{ ID: h2.LocalPeer(), Addrs: h2.ListenAddresses(), }) + require.NoError(t, err) // No context passed in, fallback to negtimeout h1.negtimeout = time.Second