aboutsummaryrefslogtreecommitdiffstats
path: root/les/serverpool.go
diff options
context:
space:
mode:
Diffstat (limited to 'les/serverpool.go')
-rw-r--r--les/serverpool.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/les/serverpool.go b/les/serverpool.go
index 9735a718e..95a8242b3 100644
--- a/les/serverpool.go
+++ b/les/serverpool.go
@@ -18,6 +18,7 @@
package les
import (
+ "fmt"
"io"
"math"
"math/rand"
@@ -28,8 +29,7 @@ import (
"github.com/ethereum/go-ethereum/common/mclock"
"github.com/ethereum/go-ethereum/ethdb"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/discv5"
@@ -162,7 +162,7 @@ func (pool *serverPool) connect(p *peer, ip net.IP, port uint16) *poolEntry {
if entry == nil {
entry = pool.findOrNewNode(p.ID(), ip, port)
}
- glog.V(logger.Debug).Infof("connecting to %v, state: %v", p.id, entry.state)
+ log.Debug(fmt.Sprintf("connecting to %v, state: %v", p.id, entry.state))
if entry.state == psConnected || entry.state == psRegistered {
return nil
}
@@ -184,7 +184,7 @@ func (pool *serverPool) connect(p *peer, ip net.IP, port uint16) *poolEntry {
// registered should be called after a successful handshake
func (pool *serverPool) registered(entry *poolEntry) {
- glog.V(logger.Debug).Infof("registered %v", entry.id.String())
+ log.Debug(fmt.Sprintf("registered %v", entry.id.String()))
pool.lock.Lock()
defer pool.lock.Unlock()
@@ -202,7 +202,7 @@ func (pool *serverPool) registered(entry *poolEntry) {
// can be updated optionally (not updated if no registration happened, in this case
// only connection statistics are updated, just like in case of timeout)
func (pool *serverPool) disconnect(entry *poolEntry) {
- glog.V(logger.Debug).Infof("disconnected %v", entry.id.String())
+ log.Debug(fmt.Sprintf("disconnected %v", entry.id.String()))
pool.lock.Lock()
defer pool.lock.Unlock()
@@ -418,7 +418,7 @@ func (pool *serverPool) findOrNewNode(id discover.NodeID, ip net.IP, port uint16
now := mclock.Now()
entry := pool.entries[id]
if entry == nil {
- glog.V(logger.Debug).Infof("discovered %v", id.String())
+ log.Debug(fmt.Sprintf("discovered %v", id.String()))
entry = &poolEntry{
id: id,
addr: make(map[string]*poolEntryAddress),
@@ -459,11 +459,11 @@ func (pool *serverPool) loadNodes() {
var list []*poolEntry
err = rlp.DecodeBytes(enc, &list)
if err != nil {
- glog.V(logger.Debug).Infof("node list decode error: %v", err)
+ log.Debug(fmt.Sprintf("node list decode error: %v", err))
return
}
for _, e := range list {
- glog.V(logger.Debug).Infof("loaded server stats %016x fails: %v connStats: %v / %v delayStats: %v / %v responseStats: %v / %v timeoutStats: %v / %v", e.id[0:8], e.lastConnected.fails, e.connectStats.avg, e.connectStats.weight, time.Duration(e.delayStats.avg), e.delayStats.weight, time.Duration(e.responseStats.avg), e.responseStats.weight, e.timeoutStats.avg, e.timeoutStats.weight)
+ log.Debug(fmt.Sprintf("loaded server stats %016x fails: %v connStats: %v / %v delayStats: %v / %v responseStats: %v / %v timeoutStats: %v / %v", e.id[0:8], e.lastConnected.fails, e.connectStats.avg, e.connectStats.weight, time.Duration(e.delayStats.avg), e.delayStats.weight, time.Duration(e.responseStats.avg), e.responseStats.weight, e.timeoutStats.avg, e.timeoutStats.weight))
pool.entries[e.id] = e
pool.knownQueue.setLatest(e)
pool.knownSelect.update((*knownEntry)(e))
@@ -568,7 +568,7 @@ func (pool *serverPool) dial(entry *poolEntry, knownSelected bool) {
pool.newSelected++
}
addr := entry.addrSelect.choose().(*poolEntryAddress)
- glog.V(logger.Debug).Infof("dialing %v out of %v, known: %v", entry.id.String()+"@"+addr.strKey(), len(entry.addr), knownSelected)
+ log.Debug(fmt.Sprintf("dialing %v out of %v, known: %v", entry.id.String()+"@"+addr.strKey(), len(entry.addr), knownSelected))
entry.dialed = addr
go func() {
pool.server.AddPeer(discover.NewNode(entry.id, addr.ip, addr.port, addr.port))
@@ -589,7 +589,7 @@ func (pool *serverPool) checkDialTimeout(entry *poolEntry) {
if entry.state != psDialed {
return
}
- glog.V(logger.Debug).Infof("timeout %v", entry.id.String()+"@"+entry.dialed.strKey())
+ log.Debug(fmt.Sprintf("timeout %v", entry.id.String()+"@"+entry.dialed.strKey()))
entry.state = psNotConnected
if entry.knownSelected {
pool.knownSelected--