Commit 7e391023 authored by Janoš Guljaš's avatar Janoš Guljaš Committed by GitHub

do not wait for nat manager in standalone mode (#837)

parent 1236d45d
...@@ -240,17 +240,19 @@ func NewBee(addr string, swarmAddress swarm.Address, publicKey ecdsa.PublicKey, ...@@ -240,17 +240,19 @@ func NewBee(addr string, swarmAddress swarm.Address, publicKey ecdsa.PublicKey,
} }
b.p2pService = p2ps b.p2pService = p2ps
if natManager := p2ps.NATManager(); natManager != nil { if !o.Standalone {
// wait for nat manager to init if natManager := p2ps.NATManager(); natManager != nil {
logger.Debug("initializing NAT manager") // wait for nat manager to init
select { logger.Debug("initializing NAT manager")
case <-natManager.Ready(): select {
// this is magic sleep to give NAT time to sync the mappings case <-natManager.Ready():
// this is a hack, kind of alchemy and should be improved // this is magic sleep to give NAT time to sync the mappings
time.Sleep(3 * time.Second) // this is a hack, kind of alchemy and should be improved
logger.Debug("NAT manager initialized") time.Sleep(3 * time.Second)
case <-time.After(10 * time.Second): logger.Debug("NAT manager initialized")
logger.Warning("NAT manager init timeout") case <-time.After(10 * time.Second):
logger.Warning("NAT manager init timeout")
}
} }
} }
......
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