Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
a3a4cf97
Commit
a3a4cf97
authored
Jan 18, 2018
by
Dmitry Shipenok
Browse files
Added default muxer in case when none was provided.
Should fix 'echo' example.
parent
7db6e54f
Changes
1
Show whitespace changes
Inline
Side-by-side
libp2p.go
View file @
a3a4cf97
...
@@ -180,13 +180,19 @@ func newWithCfg(ctx context.Context, cfg *Config) (host.Host, error) {
...
@@ -180,13 +180,19 @@ func newWithCfg(ctx context.Context, cfg *Config) (host.Host, error) {
ps
=
pstore
.
NewPeerstore
()
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 secio is disabled, don't add our private key to the peerstore
if
!
cfg
.
DisableSecio
{
if
!
cfg
.
DisableSecio
{
ps
.
AddPrivKey
(
pid
,
cfg
.
PeerKey
)
ps
.
AddPrivKey
(
pid
,
cfg
.
PeerKey
)
ps
.
AddPubKey
(
pid
,
cfg
.
PeerKey
.
GetPublic
())
ps
.
AddPubKey
(
pid
,
cfg
.
PeerKey
.
GetPublic
())
}
}
swrm
,
err
:=
swarm
.
NewSwarmWithProtector
(
ctx
,
cfg
.
ListenAddrs
,
pid
,
ps
,
cfg
.
Protector
,
cfg
.
M
uxer
,
cfg
.
Reporter
)
swrm
,
err
:=
swarm
.
NewSwarmWithProtector
(
ctx
,
cfg
.
ListenAddrs
,
pid
,
ps
,
cfg
.
Protector
,
m
uxer
,
cfg
.
Reporter
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment