(now time.Time)
| 277 | } |
| 278 | |
| 279 | func (w *progressReader) flushWithTime(now time.Time) { |
| 280 | if w.state == nil { |
| 281 | w.pending = 0 |
| 282 | w.lastFlush = now |
| 283 | w.readChecks = 0 |
| 284 | return |
| 285 | } |
| 286 | |
| 287 | if w.pending == 0 && w.written == 0 { |
| 288 | return |
| 289 | } |
| 290 | |
| 291 | w.state.Downloaded.Store(w.written) |
| 292 | w.state.VerifiedProgress.Store(w.written) |
| 293 | w.pending = 0 |
| 294 | w.lastFlush = now |
| 295 | w.readChecks = 0 |
| 296 | } |