Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth,p2p: count timeout packet towards rtt #25588

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions eth/protocols/snap/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ func (s *Syncer) assignAccountTasks(success chan *accountResponse, fail chan *ac
}
req.timeout = time.AfterFunc(s.rates.TargetTimeout(), func() {
peer.Log().Debug("Account range request timed out", "reqid", reqid)
s.rates.Update(idle, AccountRangeMsg, 0, 0)
s.rates.Update(idle, AccountRangeMsg, 2*time.Since(req.time), 0)
s.scheduleRevertAccountRequest(req)
})
s.accountReqs[reqid] = req
Expand Down Expand Up @@ -1071,7 +1071,7 @@ func (s *Syncer) assignBytecodeTasks(success chan *bytecodeResponse, fail chan *
}
req.timeout = time.AfterFunc(s.rates.TargetTimeout(), func() {
peer.Log().Debug("Bytecode request timed out", "reqid", reqid)
s.rates.Update(idle, ByteCodesMsg, 0, 0)
s.rates.Update(idle, ByteCodesMsg, 2*time.Since(req.time), 0)
s.scheduleRevertBytecodeRequest(req)
})
s.bytecodeReqs[reqid] = req
Expand Down Expand Up @@ -1218,7 +1218,7 @@ func (s *Syncer) assignStorageTasks(success chan *storageResponse, fail chan *st
}
req.timeout = time.AfterFunc(s.rates.TargetTimeout(), func() {
peer.Log().Debug("Storage request timed out", "reqid", reqid)
s.rates.Update(idle, StorageRangesMsg, 0, 0)
s.rates.Update(idle, StorageRangesMsg, 2*time.Since(req.time), 0)
s.scheduleRevertStorageRequest(req)
})
s.storageReqs[reqid] = req
Expand Down Expand Up @@ -1351,7 +1351,7 @@ func (s *Syncer) assignTrienodeHealTasks(success chan *trienodeHealResponse, fai
}
req.timeout = time.AfterFunc(s.rates.TargetTimeout(), func() {
peer.Log().Debug("Trienode heal request timed out", "reqid", reqid)
s.rates.Update(idle, TrieNodesMsg, 0, 0)
s.rates.Update(idle, TrieNodesMsg, 2*time.Since(req.time), 0)
s.scheduleRevertTrienodeHealRequest(req)
})
s.trienodeHealReqs[reqid] = req
Expand Down Expand Up @@ -1467,7 +1467,7 @@ func (s *Syncer) assignBytecodeHealTasks(success chan *bytecodeHealResponse, fai
}
req.timeout = time.AfterFunc(s.rates.TargetTimeout(), func() {
peer.Log().Debug("Bytecode heal request timed out", "reqid", reqid)
s.rates.Update(idle, ByteCodesMsg, 0, 0)
s.rates.Update(idle, ByteCodesMsg, 2*time.Since(req.time), 0)
s.scheduleRevertBytecodeHealRequest(req)
})
s.bytecodeHealReqs[reqid] = req
Expand Down
3 changes: 3 additions & 0 deletions p2p/msgrate/msgrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ func (t *Tracker) Update(kind uint64, elapsed time.Duration, items int) {
// to minimum
if items == 0 {
t.capacity[kind] = 0
if elapsed > 0 {
t.roundtrip = time.Duration((1-measurementImpact)*float64(t.roundtrip) + measurementImpact*float64(elapsed))
}
return
}
// Otherwise update the throughput with a new measurement
Expand Down