1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 17:36:38 +08:00

some comments

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2016-02-01 16:39:17 -08:00
parent c7c1e72eaf
commit 6e863830bf

View File

@ -71,6 +71,7 @@ func (rl *ReqLog) maybeCleanup() {
func (rl *ReqLog) cleanup() {
var i int
// drop all logs at are inactive and more than an hour old
for ; i < len(rl.Requests); i++ {
req := rl.Requests[i]
if req.Active || req.EndTime.Add(time.Hour).After(time.Now()) {
@ -89,6 +90,7 @@ func (rl *ReqLog) cleanup() {
}
}
// Report generates a copy of all the entries in the requestlog
func (rl *ReqLog) Report() []*ReqLogEntry {
rl.lock.Lock()
defer rl.lock.Unlock()