aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-30 04:49:58 +0800
committerobscuren <geffobscura@gmail.com>2015-04-30 04:49:58 +0800
commit01e3d694a68b55d44d92754db5e84eb2930988ab (patch)
tree9c0087a12d47dad4b52de65a23dea22783d0a73f /p2p
parent9e63798d0362a27b3ef45345d93f4a01c3349516 (diff)
downloadgo-tangerine-01e3d694a68b55d44d92754db5e84eb2930988ab.tar
go-tangerine-01e3d694a68b55d44d92754db5e84eb2930988ab.tar.gz
go-tangerine-01e3d694a68b55d44d92754db5e84eb2930988ab.tar.bz2
go-tangerine-01e3d694a68b55d44d92754db5e84eb2930988ab.tar.lz
go-tangerine-01e3d694a68b55d44d92754db5e84eb2930988ab.tar.xz
go-tangerine-01e3d694a68b55d44d92754db5e84eb2930988ab.tar.zst
go-tangerine-01e3d694a68b55d44d92754db5e84eb2930988ab.zip
p2p: added received at to peer message
p2p.Msg.ReceivedAt can be used for determining block propagation from begining to end.
Diffstat (limited to 'p2p')
-rw-r--r--p2p/message.go7
-rw-r--r--p2p/peer.go1
2 files changed, 5 insertions, 3 deletions
diff --git a/p2p/message.go b/p2p/message.go
index be6405d6f..5ab5ab73e 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 1262ba64a..bc0e6eb5f 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