Commit 01e3d694 authored by obscuren's avatar obscuren

p2p: added received at to peer message

p2p.Msg.ReceivedAt can be used for determining block propagation from
begining to end.
parent 9e63798d
...@@ -25,6 +25,7 @@ type Msg struct { ...@@ -25,6 +25,7 @@ type Msg struct {
Code uint64 Code uint64
Size uint32 // size of the paylod Size uint32 // size of the paylod
Payload io.Reader Payload io.Reader
ReceivedAt time.Time
} }
// Decode parses the RLP content of a message into // Decode parses the RLP content of a message into
......
...@@ -177,6 +177,7 @@ func (p *Peer) readLoop(errc chan<- error) { ...@@ -177,6 +177,7 @@ func (p *Peer) readLoop(errc chan<- error) {
errc <- err errc <- err
return return
} }
msg.ReceivedAt = time.Now()
if err = p.handle(msg); err != nil { if err = p.handle(msg); err != nil {
errc <- err errc <- err
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment