Skip to content

Commit

Permalink
Merge pull request #20 from libp2p/feat/stream-interfaces
Browse files Browse the repository at this point in the history
feat: update stream interfaces
  • Loading branch information
Stebalien authored Sep 2, 2020
2 parents 880e035 + 03bda6b commit c2e7d8a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 45 deletions.
12 changes: 10 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ func (c *conn) IsClosed() bool {

// OpenStream creates a new stream.
func (c *conn) OpenStream() (mux.MuxedStream, error) {
return c.mplex().NewStream()
s, err := c.mplex().NewStream()
if err != nil {
return nil, err
}
return (*stream)(s), nil
}

// AcceptStream accepts a stream opened by the other side.
func (c *conn) AcceptStream() (mux.MuxedStream, error) {
return c.mplex().Accept()
s, err := c.mplex().Accept()
if err != nil {
return nil, err
}
return (*stream)(s), nil
}

func (c *conn) mplex() *mp.Multiplex {
Expand Down
10 changes: 3 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ module github.com/libp2p/go-libp2p-mplex
go 1.12

require (
github.com/ipfs/go-log v1.0.4 // indirect
github.com/ipfs/go-log/v2 v2.1.1 // indirect
github.com/libp2p/go-libp2p-core v0.6.1
github.com/libp2p/go-libp2p-testing v0.1.1
github.com/libp2p/go-mplex v0.1.2
github.com/opentracing/opentracing-go v1.2.0 // indirect
go.uber.org/zap v1.15.0 // indirect
github.com/libp2p/go-libp2p-core v0.7.0
github.com/libp2p/go-libp2p-testing v0.3.0
github.com/libp2p/go-mplex v0.2.0
)
Loading

0 comments on commit c2e7d8a

Please sign in to comment.