remove conn.Serve
package peerstream_multiplex
import (
- "errors"
"net"
smux "github.com/libp2p/go-stream-muxer"
mp "github.com/whyrusleeping/go-multiplex" // Conn is a connection to a remote peer.
)
-var ErrUseServe = errors.New("not implemented, use Serve")
-
type conn struct {
*mp.Multiplex
}
@@ -32,18 +29,6 @@ func (c *conn) AcceptStream() (smux.Stream, error) {
return c.Multiplex.Accept()
}
-// Serve starts listening for incoming requests and handles them
-// using given StreamHandler
-func (c *conn) Serve(handler smux.StreamHandler) {
- for {
- s, err := c.AcceptStream()
- if err != nil {
- return
- }
- go handler(s)
- }
-}
-
// Transport is a go-peerstream transport that constructs
// multiplex-backed connections.
type Transport struct{}
