Browse Source

show listener external address in log

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

+ 2
- 1
main.go View File

@ -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) {


+ 5
- 0
p2p/listener.go View File

@ -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


Loading…
Cancel
Save