aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorSonic <sonic@dexon.org>2019-03-18 08:43:39 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:23 +0800
commit671e8fb6441fef5365bc357fe27c9fda6c98f4db (patch)
tree2829e824fc972b76392b85f9940f2f08fdf38be6 /p2p
parent76d5bfcaf0a4c816842b561e3b3b995c1e766d1f (diff)
downloadgo-tangerine-671e8fb6441fef5365bc357fe27c9fda6c98f4db.tar
go-tangerine-671e8fb6441fef5365bc357fe27c9fda6c98f4db.tar.gz
go-tangerine-671e8fb6441fef5365bc357fe27c9fda6c98f4db.tar.bz2
go-tangerine-671e8fb6441fef5365bc357fe27c9fda6c98f4db.tar.lz
go-tangerine-671e8fb6441fef5365bc357fe27c9fda6c98f4db.tar.xz
go-tangerine-671e8fb6441fef5365bc357fe27c9fda6c98f4db.tar.zst
go-tangerine-671e8fb6441fef5365bc357fe27c9fda6c98f4db.zip
p2p, dex: add debug log (#269)
Diffstat (limited to 'p2p')
-rw-r--r--p2p/peer.go4
-rw-r--r--p2p/server.go1
2 files changed, 5 insertions, 0 deletions
diff --git a/p2p/peer.go b/p2p/peer.go
index 9183082a1..cb6a7e484 100644
--- a/p2p/peer.go
+++ b/p2p/peer.go
@@ -249,6 +249,7 @@ loop:
close(p.closed)
p.rw.close(reason)
+ p.Log().Debug("wait for close")
p.wg.Wait()
return remoteRequested, err
}
@@ -257,6 +258,7 @@ func (p *Peer) pingLoop() {
ping := time.NewTimer(pingInterval)
defer p.wg.Done()
defer ping.Stop()
+ defer p.Log().Debug("pingLoop stopped")
for {
select {
case <-ping.C:
@@ -273,6 +275,7 @@ func (p *Peer) pingLoop() {
func (p *Peer) readLoop(errc chan<- error) {
defer p.wg.Done()
+ defer p.Log().Debug("readLoop stopped")
for {
msg, err := p.rw.ReadMsg()
if err != nil {
@@ -317,6 +320,7 @@ func (p *Peer) handle(msg Msg) error {
case proto.in <- msg:
return nil
case <-p.closed:
+ p.Log().Debug("peer handle closed return EOF")
return io.EOF
}
}
diff --git a/p2p/server.go b/p2p/server.go
index c1cf0f9fe..bfd991b1b 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -1087,6 +1087,7 @@ func (srv *Server) runPeer(p *Peer) {
Error: err.Error(),
})
+ p.Log().Debug("send peer drop", "req", remoteRequested, "err", err)
// Note: run waits for existing peers to be sent on srv.delpeer
// before returning, so this send should not select on srv.quit.
srv.delpeer <- peerDrop{p, err, remoteRequested}