Commit d59ca83d authored by Steven Allen's avatar Steven Allen
Browse files

switch to DisablePing instead of PingCustom

parent 7eaeeaa9
...@@ -57,8 +57,7 @@ type Config struct { ...@@ -57,8 +57,7 @@ type Config struct {
Peerstore pstore.Peerstore Peerstore pstore.Peerstore
Reporter metrics.Reporter Reporter metrics.Reporter
PingCustom bool DisablePing bool
Ping bool
} }
// NewNode constructs a new libp2p Host from the Config. // NewNode constructs a new libp2p Host from the Config.
...@@ -105,7 +104,7 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) { ...@@ -105,7 +104,7 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) {
ConnManager: cfg.ConnManager, ConnManager: cfg.ConnManager,
AddrsFactory: cfg.AddrsFactory, AddrsFactory: cfg.AddrsFactory,
NATManager: cfg.NATManager, NATManager: cfg.NATManager,
EnablePing: cfg.Ping, EnablePing: !cfg.DisablePing,
}) })
if err != nil { if err != nil {
swrm.Close() swrm.Close()
......
...@@ -75,11 +75,6 @@ var DefaultEnableRelay = func(cfg *Config) error { ...@@ -75,11 +75,6 @@ var DefaultEnableRelay = func(cfg *Config) error {
return cfg.Apply(EnableRelay()) return cfg.Apply(EnableRelay())
} }
// DefaultEnablePing enables the ping service by default
var DefaultEnablePing = func(cfg *Config) error {
return cfg.Apply(Ping(true))
}
// Complete list of default options and when to fallback on them. // Complete list of default options and when to fallback on them.
// //
// Please *DON'T* specify default options any other way. Putting this all here // Please *DON'T* specify default options any other way. Putting this all here
...@@ -116,10 +111,6 @@ var defaults = []struct { ...@@ -116,10 +111,6 @@ var defaults = []struct {
fallback: func(cfg *Config) bool { return !cfg.RelayCustom }, fallback: func(cfg *Config) bool { return !cfg.RelayCustom },
opt: DefaultEnableRelay, opt: DefaultEnableRelay,
}, },
{
fallback: func(cfg *Config) bool { return !cfg.PingCustom },
opt: DefaultEnablePing,
},
} }
// Defaults configures libp2p to use the default options. Can be combined with // Defaults configures libp2p to use the default options. Can be combined with
......
...@@ -255,8 +255,7 @@ func NATManager(nm config.NATManagerC) Option { ...@@ -255,8 +255,7 @@ func NATManager(nm config.NATManagerC) Option {
// Ping will configure libp2p to support the ping service; enable by default. // Ping will configure libp2p to support the ping service; enable by default.
func Ping(enable bool) Option { func Ping(enable bool) Option {
return func(cfg *Config) error { return func(cfg *Config) error {
cfg.PingCustom = true cfg.DisablePing = !enable
cfg.Ping = enable
return nil return nil
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment