Browse Source

implement AcceptStream

pull/1450/head
Juan Batiz-Benet 9 years ago
parent
commit
aab33b0374
  1. 8
      p2p/muxer/mplex/multiplex.go

8
p2p/muxer/mplex/multiplex.go

@ -1,12 +1,15 @@
package peerstream_multiplex package peerstream_multiplex
import ( import (
"errors"
"net" "net"
smux "github.com/jbenet/go-stream-muxer" smux "github.com/jbenet/go-stream-muxer"
mp "github.com/jbenet/go-stream-muxer/Godeps/_workspace/src/github.com/whyrusleeping/go-multiplex" // Conn is a connection to a remote peer. mp "github.com/jbenet/go-stream-muxer/Godeps/_workspace/src/github.com/whyrusleeping/go-multiplex" // Conn is a connection to a remote peer.
) )
var ErrUseServe = errors.New("not implemented, use Serve")
type conn struct { type conn struct {
*mp.Multiplex *mp.Multiplex
} }
@ -24,6 +27,11 @@ func (c *conn) OpenStream() (smux.Stream, error) {
return c.Multiplex.NewStream(), nil return c.Multiplex.NewStream(), nil
} }
// AcceptStream accepts a stream opened by the other side.
func (c *conn) AcceptStream() (smux.Stream, error) {
return nil, ErrUseServe
}
// Serve starts listening for incoming requests and handles them // Serve starts listening for incoming requests and handles them
// using given StreamHandler // using given StreamHandler
func (c *conn) Serve(handler smux.StreamHandler) { func (c *conn) Serve(handler smux.StreamHandler) {

Loading…
Cancel
Save