Commit e3e71973 authored by Steven Allen's avatar Steven Allen

chore: simplify

parent 8f653d3c
...@@ -202,7 +202,7 @@ func runDistribution(b *testing.B, instances []testinstance.Instance, blocks []b ...@@ -202,7 +202,7 @@ func runDistribution(b *testing.B, instances []testinstance.Instance, blocks []b
nst := fetcher.Adapter.Stats() nst := fetcher.Adapter.Stats()
stats := runStats{ stats := runStats{
Time: time.Now().Sub(start), Time: time.Since(start),
MsgRecd: nst.MessagesRecvd, MsgRecd: nst.MessagesRecvd,
MsgSent: nst.MessagesSent, MsgSent: nst.MessagesSent,
Dups: st.DupBlksReceived, Dups: st.DupBlksReceived,
......
...@@ -41,16 +41,12 @@ func (r *receiver) ReceiveError(err error) { ...@@ -41,16 +41,12 @@ func (r *receiver) ReceiveError(err error) {
func (r *receiver) PeerConnected(p peer.ID) { func (r *receiver) PeerConnected(p peer.ID) {
r.peers[p] = struct{}{} r.peers[p] = struct{}{}
select { r.connectionEvent <- struct{}{}
case r.connectionEvent <- struct{}{}:
}
} }
func (r *receiver) PeerDisconnected(p peer.ID) { func (r *receiver) PeerDisconnected(p peer.ID) {
delete(r.peers, p) delete(r.peers, p)
select { r.connectionEvent <- struct{}{}
case r.connectionEvent <- struct{}{}:
}
} }
func TestMessageSendAndReceive(t *testing.T) { func TestMessageSendAndReceive(t *testing.T) {
// create network // create network
......
...@@ -43,7 +43,7 @@ func (lt *latencyTracker) CheckDuration(key cid.Cid) (time.Duration, bool) { ...@@ -43,7 +43,7 @@ func (lt *latencyTracker) CheckDuration(key cid.Cid) (time.Duration, bool) {
request, ok := lt.requests[key] request, ok := lt.requests[key]
var latency time.Duration var latency time.Duration
if ok { if ok {
latency = time.Now().Sub(request.startedAt) latency = time.Since(request.startedAt)
} }
return latency, ok return latency, ok
} }
......
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