Merge pull request #980 from filecoin-project/feat/enable-ping

libp2p: enable ping
This commit is contained in:
Łukasz Magiera 2019-12-18 21:37:25 +01:00 committed by GitHub
commit c0fa262ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@
/lotuspond/front/build /lotuspond/front/build
/cmd/lotus-townhall/townhall/node_modules /cmd/lotus-townhall/townhall/node_modules
/cmd/lotus-townhall/townhall/build /cmd/lotus-townhall/townhall/build
extern/filecoin-ffi/rust/target
**/*.h **/*.h
**/*.a **/*.a
**/*.pc **/*.pc

View File

@ -42,7 +42,12 @@ func Host(mctx helpers.MetricsCtx, lc fx.Lifecycle, params P2PHostIn) (RawHost,
return nil, fmt.Errorf("missing private key for node ID: %s", params.ID.Pretty()) return nil, fmt.Errorf("missing private key for node ID: %s", params.ID.Pretty())
} }
opts := []libp2p.Option{libp2p.Identity(pkey), libp2p.Peerstore(params.Peerstore), libp2p.NoListenAddrs, libp2p.UserAgent("lotus-" + build.UserVersion)} opts := []libp2p.Option{
libp2p.Identity(pkey),
libp2p.Peerstore(params.Peerstore),
libp2p.NoListenAddrs,
libp2p.Ping(true),
libp2p.UserAgent("lotus-" + build.UserVersion)}
for _, o := range params.Opts { for _, o := range params.Opts {
opts = append(opts, o...) opts = append(opts, o...)
} }