Skip to content

Commit

Permalink
migrate to consolidated types; add travis config. (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk authored May 26, 2019
1 parent bb1e787 commit 486ba75
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions p2p/muxer/muxer-multistream/multistream.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"net"
"time"

smux "github.com/libp2p/go-stream-muxer"
"github.com/libp2p/go-libp2p-core/mux"

mss "github.com/multiformats/go-multistream"
)

Expand All @@ -16,7 +17,7 @@ var DefaultNegotiateTimeout = time.Second * 60
type Transport struct {
mux *mss.MultistreamMuxer

tpts map[string]smux.Transport
tpts map[string]mux.Multiplexer

NegotiateTimeout time.Duration

Expand All @@ -26,18 +27,18 @@ type Transport struct {
func NewBlankTransport() *Transport {
return &Transport{
mux: mss.NewMultistreamMuxer(),
tpts: make(map[string]smux.Transport),
tpts: make(map[string]mux.Multiplexer),
NegotiateTimeout: DefaultNegotiateTimeout,
}
}

func (t *Transport) AddTransport(path string, tpt smux.Transport) {
func (t *Transport) AddTransport(path string, tpt mux.Multiplexer) {
t.mux.AddHandler(path, nil)
t.tpts[path] = tpt
t.OrderPreference = append(t.OrderPreference, path)
}

func (t *Transport) NewConn(nc net.Conn, isServer bool) (smux.Conn, error) {
func (t *Transport) NewConn(nc net.Conn, isServer bool) (mux.MuxedConn, error) {
if t.NegotiateTimeout != 0 {
if err := nc.SetDeadline(time.Now().Add(t.NegotiateTimeout)); err != nil {
return nil, err
Expand Down

0 comments on commit 486ba75

Please sign in to comment.