Continue with server startup, even if UPNP has failed

This commit is contained in:
John Griffith 2018-01-20 17:59:43 +00:00 committed by Wilmer Paulino
parent b59077109c
commit 0d0078baac
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -310,27 +310,23 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
// Connect to router // Connect to router
d, err := upnp.DiscoverCtx(context.Background()) d, err := upnp.DiscoverCtx(context.Background())
if err != nil { if err != nil {
fmt.Printf("Upnp: Unable to discover router %v\n", err) srvrLog.Errorf("Upnp: Unable to discover router %v\n", err)
return nil, err
} }
// Get external IP // Get external IP
ip, err := d.ExternalIP() ip, err := d.ExternalIP()
if err != nil { if err != nil {
fmt.Printf("Upnp: Unable to get external ip %v\n", err) srvrLog.Errorf("Upnp: Unable to get external ip %v\n", err)
return nil, err
} }
ltndLog.Infof("Your external IP is: %s", ip)
// Forward peer port // Forward peer port
err = d.Forward(uint16(cfg.PeerPort), "lnd peer port") err = d.Forward(uint16(cfg.PeerPort), "lnd peer port")
if err != nil { if err != nil {
fmt.Printf("Upnp: Unable to forward pear port ip %v\n", err) srvrLog.Errorf("Upnp: Unable to forward pear port ip %v\n", err)
return nil, err } else {
} srvrLog.Infof("Your external IP is: %s", ip)
externalIPs = append(externalIPs, ip) externalIPs = append(externalIPs, ip)
}
} }