From 01e3d694a68b55d44d92754db5e84eb2930988ab Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 29 Apr 2015 22:49:58 +0200 Subject: [PATCH] p2p: added received at to peer message p2p.Msg.ReceivedAt can be used for determining block propagation from begining to end. --- p2p/message.go | 7 ++++--- p2p/peer.go | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/p2p/message.go b/p2p/message.go index be6405d6f0..5ab5ab73e0 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -22,9 +22,10 @@ import ( // structure, encode the payload into a byte array and create a // separate Msg with a bytes.Reader as Payload for each send. type Msg struct { - Code uint64 - Size uint32 // size of the paylod - Payload io.Reader + Code uint64 + Size uint32 // size of the paylod + Payload io.Reader + ReceivedAt time.Time } // Decode parses the RLP content of a message into diff --git a/p2p/peer.go b/p2p/peer.go index 1262ba64a7..bc0e6eb5f1 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -177,6 +177,7 @@ func (p *Peer) readLoop(errc chan<- error) { errc <- err return } + msg.ReceivedAt = time.Now() if err = p.handle(msg); err != nil { errc <- err return