From b531597a537cb1c8d1f93823a52ee6488c45bd78 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Thu, 10 Jul 2014 22:19:58 -0700 Subject: [PATCH] show listener external address in log --- main.go | 3 ++- p2p/listener.go | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index f08868621..e904754e1 100644 --- a/main.go +++ b/main.go @@ -76,6 +76,7 @@ func (n *Node) initPeer(peer *p2p.Peer) { // Add a Listener to accept incoming peer connections. func (n *Node) AddListener(l p2p.Listener) { + log.Infof("Adding listener %v", l) go func() { for { inConn, ok := <-l.Connections() @@ -109,7 +110,7 @@ func (n *Node) ensurePeers() { for j := 0; i < 3; j++ { picked = n.book.PickAddress(newBias) if picked == nil { - log.Infof("Empty addrbook.") + log.Debug("Empty addrbook.") return } if n.sw.Peers().Has(picked) { diff --git a/p2p/listener.go b/p2p/listener.go index 708b463f3..357ec1e57 100644 --- a/p2p/listener.go +++ b/p2p/listener.go @@ -1,6 +1,7 @@ package p2p import ( + "fmt" "net" "strconv" "sync/atomic" @@ -113,6 +114,10 @@ func (l *DefaultListener) Stop() { } } +func (l *DefaultListener) String() string { + return fmt.Sprintf("Listener(@%v)", l.extAddr) +} + /* external address helpers */ // UPNP external address discovery & port mapping