Skip to content

Commit

Permalink
feat: use go-libp2p-core 0.7.0 stream interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Nov 2, 2020
1 parent 20d0395 commit 3d76385
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 18 deletions.
8 changes: 1 addition & 7 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net"
"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 @@ -36,12 +35,7 @@ func (c *conn) Write(b []byte) (n int, err error) {
// Close closes the connection.
// Any blocked Read or Write operations will be unblocked and return errors.
func (c *conn) Close() error {
if err := c.s.Close(); err != nil {
c.s.Reset()
return err
}
go helpers.AwaitEOF(c.s)
return nil
return c.s.Close()
}

// LocalAddr returns the local network address.
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/libp2p/go-libp2p-gostream
go 1.14

require (
github.com/libp2p/go-libp2p v0.7.2
github.com/libp2p/go-libp2p-core v0.5.0
github.com/multiformats/go-multiaddr v0.2.1
github.com/libp2p/go-libp2p v0.11.1-0.20201102192925-b33cbc714465
github.com/libp2p/go-libp2p-core v0.7.0
github.com/multiformats/go-multiaddr v0.3.1
)
Loading

0 comments on commit 3d76385

Please sign in to comment.