Unverified Commit b4720fab authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #445 from ipfs/feat/rw-close

feat: update for go-libp2p-core 0.7.0 interface changes
parents 7ca6d63b 7c5676ac
...@@ -3,32 +3,31 @@ module github.com/ipfs/go-bitswap ...@@ -3,32 +3,31 @@ module github.com/ipfs/go-bitswap
require ( require (
github.com/cskr/pubsub v1.0.2 github.com/cskr/pubsub v1.0.2
github.com/gogo/protobuf v1.3.1 github.com/gogo/protobuf v1.3.1
github.com/golang/protobuf v1.3.2 // indirect github.com/google/uuid v1.1.2
github.com/google/uuid v1.1.1
github.com/ipfs/go-block-format v0.0.2 github.com/ipfs/go-block-format v0.0.2
github.com/ipfs/go-cid v0.0.5 github.com/ipfs/go-cid v0.0.7
github.com/ipfs/go-datastore v0.4.4 github.com/ipfs/go-datastore v0.4.5
github.com/ipfs/go-detect-race v0.0.1 github.com/ipfs/go-detect-race v0.0.1
github.com/ipfs/go-ipfs-blockstore v0.1.4 github.com/ipfs/go-ipfs-blockstore v0.1.4
github.com/ipfs/go-ipfs-blocksutil v0.0.1 github.com/ipfs/go-ipfs-blocksutil v0.0.1
github.com/ipfs/go-ipfs-delay v0.0.1 github.com/ipfs/go-ipfs-delay v0.0.1
github.com/ipfs/go-ipfs-exchange-interface v0.0.1 github.com/ipfs/go-ipfs-exchange-interface v0.0.1
github.com/ipfs/go-ipfs-routing v0.1.0 github.com/ipfs/go-ipfs-routing v0.1.0
github.com/ipfs/go-ipfs-util v0.0.1 github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-log v1.0.4 github.com/ipfs/go-log v1.0.4
github.com/ipfs/go-metrics-interface v0.0.1 github.com/ipfs/go-metrics-interface v0.0.1
github.com/ipfs/go-peertaskqueue v0.2.0 github.com/ipfs/go-peertaskqueue v0.2.0
github.com/jbenet/goprocess v0.1.4 github.com/jbenet/goprocess v0.1.4
github.com/libp2p/go-buffer-pool v0.0.2 github.com/libp2p/go-buffer-pool v0.0.2
github.com/libp2p/go-libp2p v0.8.3 github.com/libp2p/go-libp2p v0.12.0
github.com/libp2p/go-libp2p-core v0.5.2 github.com/libp2p/go-libp2p-core v0.7.0
github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-loggables v0.1.0
github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-netutil v0.1.0
github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-testing v0.3.0
github.com/libp2p/go-msgio v0.0.4 github.com/libp2p/go-msgio v0.0.6
github.com/multiformats/go-multiaddr v0.2.1 github.com/multiformats/go-multiaddr v0.3.1
github.com/multiformats/go-multistream v0.1.1 github.com/multiformats/go-multistream v0.2.0
go.uber.org/zap v1.14.1 go.uber.org/zap v1.16.0
) )
go 1.12 go 1.12
This diff is collapsed.
...@@ -2,6 +2,7 @@ package sessionmanager ...@@ -2,6 +2,7 @@ package sessionmanager
import ( import (
"context" "context"
"fmt"
"sync" "sync"
"testing" "testing"
"time" "time"
...@@ -118,7 +119,7 @@ func TestReceiveFrom(t *testing.T) { ...@@ -118,7 +119,7 @@ func TestReceiveFrom(t *testing.T) {
pm := &fakePeerManager{} pm := &fakePeerManager{}
sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "")
p := peer.ID(123) p := peer.ID(fmt.Sprint(123))
block := blocks.NewBlock([]byte("block")) block := blocks.NewBlock([]byte("block"))
firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession)
...@@ -165,7 +166,7 @@ func TestReceiveBlocksWhenManagerShutdown(t *testing.T) { ...@@ -165,7 +166,7 @@ func TestReceiveBlocksWhenManagerShutdown(t *testing.T) {
pm := &fakePeerManager{} pm := &fakePeerManager{}
sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "")
p := peer.ID(123) p := peer.ID(fmt.Sprint(123))
block := blocks.NewBlock([]byte("block")) block := blocks.NewBlock([]byte("block"))
firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession)
...@@ -199,7 +200,7 @@ func TestReceiveBlocksWhenSessionContextCancelled(t *testing.T) { ...@@ -199,7 +200,7 @@ func TestReceiveBlocksWhenSessionContextCancelled(t *testing.T) {
pm := &fakePeerManager{} pm := &fakePeerManager{}
sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "")
p := peer.ID(123) p := peer.ID(fmt.Sprint(123))
block := blocks.NewBlock([]byte("block")) block := blocks.NewBlock([]byte("block"))
firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession)
...@@ -235,7 +236,7 @@ func TestShutdown(t *testing.T) { ...@@ -235,7 +236,7 @@ func TestShutdown(t *testing.T) {
pm := &fakePeerManager{} pm := &fakePeerManager{}
sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "")
p := peer.ID(123) p := peer.ID(fmt.Sprint(123))
block := blocks.NewBlock([]byte("block")) block := blocks.NewBlock([]byte("block"))
cids := []cid.Cid{block.Cid()} cids := []cid.Cid{block.Cid()}
firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession)
......
package testutil package testutil
import ( import (
"fmt"
"math/rand" "math/rand"
bsmsg "github.com/ipfs/go-bitswap/message" bsmsg "github.com/ipfs/go-bitswap/message"
...@@ -59,7 +60,7 @@ func GeneratePeers(n int) []peer.ID { ...@@ -59,7 +60,7 @@ func GeneratePeers(n int) []peer.ID {
peerIds := make([]peer.ID, 0, n) peerIds := make([]peer.ID, 0, n)
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
peerSeq++ peerSeq++
p := peer.ID(peerSeq) p := peer.ID(fmt.Sprint(i))
peerIds = append(peerIds, p) peerIds = append(peerIds, p)
} }
return peerIds return peerIds
......
...@@ -13,7 +13,6 @@ import ( ...@@ -13,7 +13,6 @@ import (
cid "github.com/ipfs/go-cid" cid "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
"github.com/libp2p/go-libp2p-core/connmgr" "github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/helpers"
"github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
...@@ -132,7 +131,7 @@ func (s *streamMessageSender) Reset() error { ...@@ -132,7 +131,7 @@ func (s *streamMessageSender) Reset() error {
// Close the stream // Close the stream
func (s *streamMessageSender) Close() error { func (s *streamMessageSender) Close() error {
return helpers.FullClose(s.stream) return s.stream.Close()
} }
// Indicates whether the peer supports HAVE / DONT_HAVE messages // Indicates whether the peer supports HAVE / DONT_HAVE messages
...@@ -323,9 +322,6 @@ func (bsnet *impl) SendMessage( ...@@ -323,9 +322,6 @@ func (bsnet *impl) SendMessage(
return err return err
} }
// TODO(https://github.com/libp2p/go-libp2p-net/issues/28): Avoid this goroutine.
//nolint
go helpers.AwaitEOF(s)
return s.Close() return s.Close()
} }
......
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