From f5c432bcab70ddc818db90ae410e07e6253585af Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 6 Sep 2016 00:26:54 +0200 Subject: p2p/nat: delay auto discovery until first use Port mapper auto discovery used to run immediately after parsing the --nat flag, giving it a slight performance boost. But this is becoming inconvenient because we create node.Node for all geth operations including account management and bare chain interaction. Delay autodiscovery until the first use instead, which avoids any network interaction until the node is actually started. --- p2p/nat/nat.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'p2p') diff --git a/p2p/nat/nat.go b/p2p/nat/nat.go index 505a1fc77..42f615f36 100644 --- a/p2p/nat/nat.go +++ b/p2p/nat/nat.go @@ -197,11 +197,7 @@ type autodisc struct { func startautodisc(what string, doit func() Interface) Interface { // TODO: monitor network configuration and rerun doit when it changes. - ad := &autodisc{what: what, doit: doit} - // Start the auto discovery as early as possible so it is already - // in progress when the rest of the stack calls the methods. - go ad.wait() - return ad + return &autodisc{what: what, doit: doit} } func (n *autodisc) AddMapping(protocol string, extport, intport int, name string, lifetime time.Duration) error { -- cgit