Skip to content

Commit

Permalink
fix: correctly wrap returned stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Sep 2, 2020
1 parent 4395e60 commit f4aa298
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions p2p/muxer/mplex/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

0 comments on commit f4aa298

Please sign in to comment.