| 98 | } |
| 99 | |
| 100 | func (i *inputStatsReader) Close() error { |
| 101 | // If we knew the size of the file in advanced, and it's not been fully |
| 102 | // processed for any rason (eg: truncated network connection), remove the |
| 103 | // remaining size from the total size, so that the ETA estimation is |
| 104 | // still correct. |
| 105 | if i.sz != 0 { |
| 106 | rem := i.sz - atomic.LoadInt64(&i.n) |
| 107 | if rem >= 0 { |
| 108 | atomic.AddInt64(&i.s.totalSize, -rem) |
| 109 | } |
| 110 | } |
| 111 | atomic.AddInt64(&i.s.processedFiles, 1) |
| 112 | |
| 113 | return i.r.Close() |
| 114 | } |
| 115 | |
| 116 | func newInputStats() *inputStats { |
| 117 | s := new(inputStats) |