Ver Fonte

log dial errors when debug enabled

Chris Bannister há 9 anos atrás
pai
commit
ffe7339162
1 ficheiros alterados com 4 adições e 1 exclusões
  1. 4 1
      connectionpool.go

+ 4 - 1
connectionpool.go

@@ -245,7 +245,7 @@ func (p *policyConnPool) addHost(host *HostInfo) {
 	pool, ok := p.hostConnPools[host.Peer()]
 	pool, ok := p.hostConnPools[host.Peer()]
 	if ok {
 	if ok {
 		p.mu.Unlock()
 		p.mu.Unlock()
-		go pool.fill()
+		pool.fill()
 		return
 		return
 	}
 	}
 
 
@@ -464,6 +464,9 @@ func (pool *hostConnPool) logConnectErr(err error) {
 	if opErr, ok := err.(*net.OpError); ok && (opErr.Op == "dial" || opErr.Op == "read") {
 	if opErr, ok := err.(*net.OpError); ok && (opErr.Op == "dial" || opErr.Op == "read") {
 		// connection refused
 		// connection refused
 		// these are typical during a node outage so avoid log spam.
 		// these are typical during a node outage so avoid log spam.
+		if debug {
+			log.Printf("unable to dial %q: %v\n", pool.host.Peer(), err)
+		}
 	} else if err != nil {
 	} else if err != nil {
 		// unexpected error
 		// unexpected error
 		log.Printf("error: failed to connect to %s due to error: %v", pool.addr, err)
 		log.Printf("error: failed to connect to %s due to error: %v", pool.addr, err)