Browse Source

log external address

pull/9/head
Jae Kwon 11 years ago
parent
commit
bbfdef5ea7
2 changed files with 7 additions and 6 deletions
  1. +1
    -0
      main.go
  2. +6
    -6
      p2p/listener.go

+ 1
- 0
main.go View File

@ -65,6 +65,7 @@ func (n *Node) Start() {
// Add a Listener to accept inbound peer connections.
func (n *Node) AddListener(l p2p.Listener) {
log.Infof("Added %v", l)
n.lz = append(n.lz, l)
}


+ 6
- 6
p2p/listener.go View File

@ -58,7 +58,7 @@ func NewDefaultListener(protocol string, lAddr string) Listener {
}
// Actual listener local IP & port
listenerIP, listenerPort := splitHostPort(listener.Addr().String())
log.Infof("Local listener: %v:%v", listenerIP, listenerPort)
log.Debugf("Local listener: %v:%v", listenerIP, listenerPort)
// Determine external address...
var extAddr *NetAddress
@ -134,16 +134,16 @@ func (l *DefaultListener) String() string {
// UPNP external address discovery & port mapping
func getUPNPExternalAddress(externalPort, internalPort int) *NetAddress {
log.Infof("Getting UPNP external address")
log.Debugf("Getting UPNP external address")
nat, err := upnp.Discover()
if err != nil {
log.Infof("Could not get UPNP extrernal address: %v", err)
log.Debugf("Could not get UPNP extrernal address: %v", err)
return nil
}
ext, err := nat.GetExternalAddress()
if err != nil {
log.Infof("Could not get UPNP external address: %v", err)
log.Debugf("Could not get UPNP external address: %v", err)
return nil
}
@ -154,11 +154,11 @@ func getUPNPExternalAddress(externalPort, internalPort int) *NetAddress {
externalPort, err = nat.AddPortMapping("tcp", externalPort, internalPort, "tendermint", 0)
if err != nil {
log.Infof("Could not get UPNP external address: %v", err)
log.Debugf("Could not get UPNP external address: %v", err)
return nil
}
log.Infof("Got UPNP external address: %v", ext)
log.Debugf("Got UPNP external address: %v", ext)
return NewNetAddressIPPort(ext, UInt16(externalPort))
}


Loading…
Cancel
Save