Skip to content

Commit

Permalink
Merge pull request #264 from dmbreaker/master
Browse files Browse the repository at this point in the history
Added default muxer in case when none was provided.
  • Loading branch information
Stebalien authored Jan 28, 2018
2 parents f5e4343 + a3a4cf9 commit b624fe6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libp2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,19 @@ func newWithCfg(ctx context.Context, cfg *Config) (host.Host, error) {
ps = pstore.NewPeerstore()
}

// Set default muxer if none was passed in
muxer := cfg.Muxer
if muxer == nil {
muxer = DefaultMuxer()
}

// If secio is disabled, don't add our private key to the peerstore
if !cfg.DisableSecio {
ps.AddPrivKey(pid, cfg.PeerKey)
ps.AddPubKey(pid, cfg.PeerKey.GetPublic())
}

swrm, err := swarm.NewSwarmWithProtector(ctx, cfg.ListenAddrs, pid, ps, cfg.Protector, cfg.Muxer, cfg.Reporter)
swrm, err := swarm.NewSwarmWithProtector(ctx, cfg.ListenAddrs, pid, ps, cfg.Protector, muxer, cfg.Reporter)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit b624fe6

Please sign in to comment.