OSDN Git Service

fix log.Debug
[bytom/vapor.git] / toolbar / precog / monitor / connection.go
index 0e27199..a6b4826 100644 (file)
@@ -10,7 +10,9 @@ import (
 )
 
 func (m *monitor) connectNodesRoutine() {
-       ticker := time.NewTicker(time.Duration(m.cfg.CheckFreqMinutes) * time.Minute)
+       // TODO: fix
+       // ticker := time.NewTicker(time.Duration(m.cfg.CheckFreqMinutes) * time.Minute)
+       ticker := time.NewTicker(time.Duration(m.cfg.CheckFreqMinutes) * time.Second)
        for ; true; <-ticker.C {
                <-m.dialCh
                m.Lock()
@@ -30,17 +32,7 @@ func (m *monitor) dialNodes() error {
 
        addresses := make([]*p2p.NetAddress, 0)
        for i := 0; i < len(nodes); i++ {
-               ips, err := net.LookupIP(nodes[i].Host)
-               if err != nil {
-                       log.Error(err)
-                       continue
-               }
-               if len(ips) == 0 {
-                       log.Errorf("fail to look up ip for %s", nodes[i].Host)
-                       continue
-               }
-
-               address := p2p.NewNetAddressIPPort(ips[0], nodes[i].Port)
+               address := p2p.NewNetAddressIPPort(net.ParseIP(nodes[i].IP), nodes[i].Port)
                addresses = append(addresses, address)
        }