Skip to content

Commit

Permalink
feat: use new stream interfaces from go-libp2p-core 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Nov 2, 2020
1 parent ac8fa95 commit aa1b8dc
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 97 deletions.
5 changes: 2 additions & 3 deletions fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"time"

"github.com/libp2p/go-libp2p-core/helpers"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
Expand Down Expand Up @@ -38,7 +37,7 @@ func newFetchProtocol(ctx context.Context, host host.Host, getData getValue) *fe
}

func (p *fetchProtocol) receive(s network.Stream, getData getValue) {
defer helpers.FullClose(s)
defer s.Close()

msg := &pb.FetchRequest{}
if err := readMsg(p.ctx, s, msg); err != nil {
Expand Down Expand Up @@ -69,7 +68,7 @@ func (p *fetchProtocol) Fetch(ctx context.Context, pid peer.ID, key string) ([]b
if err != nil {
return nil, err
}
defer helpers.FullClose(s)
defer s.Close()

msg := &pb.FetchRequest{Identifier: key}

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ require (
github.com/ipfs/go-ipfs-ds-help v0.1.1
github.com/ipfs/go-log/v2 v2.1.1
github.com/libp2p/go-libp2p-blankhost v0.2.0
github.com/libp2p/go-libp2p-core v0.6.0
github.com/libp2p/go-libp2p-pubsub v0.3.2
github.com/libp2p/go-libp2p-core v0.7.0
github.com/libp2p/go-libp2p-pubsub v0.3.7-0.20201102195318-94f268af9768
github.com/libp2p/go-libp2p-record v0.1.3
github.com/libp2p/go-libp2p-swarm v0.2.8
github.com/libp2p/go-libp2p-swarm v0.3.1
github.com/libp2p/go-msgio v0.0.6
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
)
Loading

0 comments on commit aa1b8dc

Please sign in to comment.