diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-22 20:10:07 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-02-23 18:16:44 +0800 |
commit | d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851 (patch) | |
tree | 17c93170551d3eeabe2935de1765f157007f0dc2 /p2p/discover/udp.go | |
parent | 47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff) | |
download | dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.bz2 dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.lz dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.xz dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip |
all: blidly swap out glog to our log15, logs need rework
Diffstat (limited to 'p2p/discover/udp.go')
-rw-r--r-- | p2p/discover/udp.go | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index ae7f97029..eafc3f394 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -26,8 +26,7 @@ import ( "time" "github.com/ethereum/go-ethereum/crypto" - "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/nat" "github.com/ethereum/go-ethereum/p2p/netutil" "github.com/ethereum/go-ethereum/rlp" @@ -224,7 +223,7 @@ func ListenUDP(priv *ecdsa.PrivateKey, laddr string, natm nat.Interface, nodeDBP if err != nil { return nil, err } - glog.V(logger.Info).Infoln("Listening,", tab.self) + log.Info(fmt.Sprint("Listening,", tab.self)) return tab, nil } @@ -294,7 +293,7 @@ func (t *udp) findnode(toid NodeID, toaddr *net.UDPAddr, target NodeID) ([]*Node nreceived++ n, err := t.nodeFromRPC(toaddr, rn) if err != nil { - glog.V(logger.Detail).Infof("invalid neighbor node (%v) from %v: %v", rn.IP, toaddr, err) + log.Trace(fmt.Sprintf("invalid neighbor node (%v) from %v: %v", rn.IP, toaddr, err)) continue } nodes = append(nodes, n) @@ -464,9 +463,9 @@ func (t *udp) send(toaddr *net.UDPAddr, ptype byte, req interface{}) error { if err != nil { return err } - glog.V(logger.Detail).Infof(">>> %v %T", toaddr, req) + log.Trace(fmt.Sprintf(">>> %v %T", toaddr, req)) if _, err = t.conn.WriteToUDP(packet, toaddr); err != nil { - glog.V(logger.Detail).Infoln("UDP send failed:", err) + log.Trace(fmt.Sprint("UDP send failed:", err)) } return err } @@ -476,13 +475,13 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte, b.Write(headSpace) b.WriteByte(ptype) if err := rlp.Encode(b, req); err != nil { - glog.V(logger.Error).Infoln("error encoding packet:", err) + log.Error(fmt.Sprint("error encoding packet:", err)) return nil, err } packet := b.Bytes() sig, err := crypto.Sign(crypto.Keccak256(packet[headSize:]), priv) if err != nil { - glog.V(logger.Error).Infoln("could not sign packet:", err) + log.Error(fmt.Sprint("could not sign packet:", err)) return nil, err } copy(packet[macSize:], sig) @@ -504,11 +503,11 @@ func (t *udp) readLoop() { nbytes, from, err := t.conn.ReadFromUDP(buf) if netutil.IsTemporaryError(err) { // Ignore temporary read errors. - glog.V(logger.Debug).Infof("Temporary read error: %v", err) + log.Debug(fmt.Sprintf("Temporary read error: %v", err)) continue } else if err != nil { // Shut down the loop for permament errors. - glog.V(logger.Debug).Infof("Read error: %v", err) + log.Debug(fmt.Sprintf("Read error: %v", err)) return } t.handlePacket(from, buf[:nbytes]) @@ -518,14 +517,14 @@ func (t *udp) readLoop() { func (t *udp) handlePacket(from *net.UDPAddr, buf []byte) error { packet, fromID, hash, err := decodePacket(buf) if err != nil { - glog.V(logger.Debug).Infof("Bad packet from %v: %v", from, err) + log.Debug(fmt.Sprintf("Bad packet from %v: %v", from, err)) return err } status := "ok" if err = packet.handle(t, from, fromID, hash); err != nil { status = err.Error() } - glog.V(logger.Detail).Infof("<<< %v %T: %s", from, packet, status) + log.Trace(fmt.Sprintf("<<< %v %T: %s", from, packet, status)) return err } |