Unverified Commit fc3558cc authored by Raúl Kripalani's avatar Raúl Kripalani Committed by GitHub

upgrade deps + uvarint delimited writer/reader. (#684)

parent 81b0285d
......@@ -34,6 +34,9 @@ type mockConn struct {
remote peer.AddrInfo
}
var _ network.Conn = (*mockConn)(nil)
func (m *mockConn) ID() string { return "0" }
func (m *mockConn) Close() error { return nil }
func (m *mockConn) NewStream() (network.Stream, error) { return nil, nil }
func (m *mockConn) GetStreams() []network.Stream { return []network.Stream{} }
......
......@@ -11,12 +11,11 @@ import (
"github.com/libp2p/go-libp2p-core/helpers"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-msgio/protoio"
"github.com/libp2p/go-libp2p-kad-dht/metrics"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
ggio "github.com/gogo/protobuf/io"
"github.com/libp2p/go-msgio"
"go.opencensus.io/stats"
"go.opencensus.io/tag"
......@@ -34,7 +33,7 @@ var ErrReadTimeout = fmt.Errorf("timed out reading response")
// packet for every single write.
type bufferedDelimitedWriter struct {
*bufio.Writer
ggio.WriteCloser
protoio.WriteCloser
}
var writerPool = sync.Pool{
......@@ -42,7 +41,7 @@ var writerPool = sync.Pool{
w := bufio.NewWriter(nil)
return &bufferedDelimitedWriter{
Writer: w,
WriteCloser: ggio.NewDelimitedWriter(w),
WriteCloser: protoio.NewDelimitedWriter(w),
}
},
}
......
......@@ -12,13 +12,14 @@ import (
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/libp2p/go-libp2p-core/routing"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
record "github.com/libp2p/go-libp2p-record"
swarmt "github.com/libp2p/go-libp2p-swarm/testing"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
"github.com/libp2p/go-msgio/protoio"
pb "github.com/libp2p/go-libp2p-kad-dht/pb"
ggio "github.com/gogo/protobuf/io"
u "github.com/ipfs/go-ipfs-util"
)
......@@ -144,8 +145,8 @@ func TestGetFailures(t *testing.T) {
host2.SetStreamHandler(proto, func(s network.Stream) {
defer s.Close()
pbr := ggio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := ggio.NewDelimitedWriter(s)
pbr := protoio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := protoio.NewDelimitedWriter(s)
pmes := new(pb.Message)
if err := pbr.ReadMsg(pmes); err != nil {
......@@ -199,8 +200,8 @@ func TestGetFailures(t *testing.T) {
}
defer s.Close()
pbr := ggio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := ggio.NewDelimitedWriter(s)
pbr := protoio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := protoio.NewDelimitedWriter(s)
if err := pbw.WriteMsg(&req); err != nil {
t.Fatal(err)
......@@ -250,8 +251,8 @@ func TestNotFound(t *testing.T) {
host.SetStreamHandler(proto, func(s network.Stream) {
defer s.Close()
pbr := ggio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := ggio.NewDelimitedWriter(s)
pbr := protoio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := protoio.NewDelimitedWriter(s)
pmes := new(pb.Message)
if err := pbr.ReadMsg(pmes); err != nil {
......@@ -347,8 +348,8 @@ func TestLessThanKResponses(t *testing.T) {
host.SetStreamHandler(proto, func(s network.Stream) {
defer s.Close()
pbr := ggio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := ggio.NewDelimitedWriter(s)
pbr := protoio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := protoio.NewDelimitedWriter(s)
pmes := new(pb.Message)
if err := pbr.ReadMsg(pmes); err != nil {
......@@ -416,8 +417,8 @@ func TestMultipleQueries(t *testing.T) {
hosts[1].SetStreamHandler(proto, func(s network.Stream) {
defer s.Close()
pbr := ggio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := ggio.NewDelimitedWriter(s)
pbr := protoio.NewDelimitedReader(s, network.MessageSizeMax)
pbw := protoio.NewDelimitedWriter(s)
pmes := new(pb.Message)
if err := pbr.ReadMsg(pmes); err != nil {
......
......@@ -4,35 +4,35 @@ go 1.14
require (
github.com/gogo/protobuf v1.3.1
github.com/google/gopacket v1.1.17
github.com/google/gopacket v1.1.18
github.com/google/uuid v1.1.1
github.com/hashicorp/go-multierror v1.1.0
github.com/hashicorp/golang-lru v0.5.4
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-detect-race v0.0.1
github.com/ipfs/go-ipfs-util v0.0.1
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipns v0.0.2
github.com/ipfs/go-log v1.0.4
github.com/jbenet/goprocess v0.1.4
github.com/libp2p/go-eventbus v0.1.0
github.com/libp2p/go-libp2p v0.8.2
github.com/libp2p/go-libp2p-core v0.5.4
github.com/libp2p/go-eventbus v0.2.1
github.com/libp2p/go-libp2p v0.10.0
github.com/libp2p/go-libp2p-core v0.6.1
github.com/libp2p/go-libp2p-kbucket v0.4.2
github.com/libp2p/go-libp2p-peerstore v0.2.4
github.com/libp2p/go-libp2p-record v0.1.2
github.com/libp2p/go-libp2p-peerstore v0.2.6
github.com/libp2p/go-libp2p-record v0.1.3
github.com/libp2p/go-libp2p-routing-helpers v0.2.3
github.com/libp2p/go-libp2p-swarm v0.2.3
github.com/libp2p/go-libp2p-testing v0.1.1
github.com/libp2p/go-msgio v0.0.4
github.com/libp2p/go-netroute v0.1.2
github.com/libp2p/go-libp2p-swarm v0.2.8
github.com/libp2p/go-libp2p-testing v0.1.2-0.20200422005655-8775583591d8
github.com/libp2p/go-msgio v0.0.6
github.com/libp2p/go-netroute v0.1.3
github.com/multiformats/go-base32 v0.0.3
github.com/multiformats/go-multiaddr v0.2.1
github.com/multiformats/go-multiaddr v0.2.2
github.com/multiformats/go-multiaddr-net v0.1.5
github.com/multiformats/go-multihash v0.0.13
github.com/multiformats/go-multistream v0.1.1
github.com/stretchr/testify v1.5.1
github.com/multiformats/go-multihash v0.0.14
github.com/multiformats/go-multistream v0.1.2
github.com/stretchr/testify v1.6.1
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1
go.opencensus.io v0.22.3
go.uber.org/zap v1.14.1
go.opencensus.io v0.22.4
go.uber.org/zap v1.15.0
)
This diff is collapsed.
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