diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-04-10 23:59:32 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-04-10 23:59:32 +0800 |
commit | 92fbb61625c8fa8f07c6ab9458b53884b8a4e95c (patch) | |
tree | 7cdf4fce82ff599fcd86aa01bd952ddf310fb2f1 /p2p/discover | |
parent | fc1d1f9afd155fab1f614c6a0340233f90afafd6 (diff) | |
parent | c5332537f5726610c3c1606ead8cbaa83144b537 (diff) | |
download | dexon-92fbb61625c8fa8f07c6ab9458b53884b8a4e95c.tar dexon-92fbb61625c8fa8f07c6ab9458b53884b8a4e95c.tar.gz dexon-92fbb61625c8fa8f07c6ab9458b53884b8a4e95c.tar.bz2 dexon-92fbb61625c8fa8f07c6ab9458b53884b8a4e95c.tar.lz dexon-92fbb61625c8fa8f07c6ab9458b53884b8a4e95c.tar.xz dexon-92fbb61625c8fa8f07c6ab9458b53884b8a4e95c.tar.zst dexon-92fbb61625c8fa8f07c6ab9458b53884b8a4e95c.zip |
Merge pull request #691 from fjl/discovery-fixes
p2p: a bunch of fixes
Diffstat (limited to 'p2p/discover')
-rw-r--r-- | p2p/discover/udp.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index a638a8f35..d37260e7d 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -335,7 +335,7 @@ func (t *udp) send(toaddr *net.UDPAddr, ptype byte, req interface{}) error { if err != nil { return err } - glog.V(logger.Detail).Infof(">>> %v %T %v\n", toaddr, req, req) + glog.V(logger.Detail).Infof(">>> %v %T\n", toaddr, req) if _, err = t.conn.WriteToUDP(packet, toaddr); err != nil { glog.V(logger.Detail).Infoln("UDP send failed:", err) } @@ -378,12 +378,11 @@ func (t *udp) readLoop() { glog.V(logger.Debug).Infof("Bad packet from %v: %v\n", from, err) continue } - glog.V(logger.Detail).Infof("<<< %v %T %v\n", from, packet, packet) - go func() { - if err := packet.handle(t, from, fromID, hash); err != nil { - glog.V(logger.Debug).Infof("error handling %T from %v: %v", packet, from, err) - } - }() + status := "ok" + if err := packet.handle(t, from, fromID, hash); err != nil { + status = err.Error() + } + glog.V(logger.Detail).Infof("<<< %v %T: %s\n", from, packet, status) } } @@ -430,7 +429,7 @@ func (req *ping) handle(t *udp, from *net.UDPAddr, fromID NodeID, mac []byte) er }) if !t.handleReply(fromID, pingPacket, req) { // Note: we're ignoring the provided IP address right now - t.bond(true, fromID, from, req.Port) + go t.bond(true, fromID, from, req.Port) } return nil } |