是否可以执行回调函数 Whether the callback function can be executed
()
| 140 | // 是否可以执行回调函数 |
| 141 | // Whether the callback function can be executed |
| 142 | func (c *flateWriter) shouldCall() bool { |
| 143 | var n = len(c.buffers) |
| 144 | if n < 2 { |
| 145 | return false |
| 146 | } |
| 147 | var sum = 0 |
| 148 | for i := 1; i < n; i++ { |
| 149 | sum += c.buffers[i].Len() |
| 150 | } |
| 151 | return sum >= 4 |
| 152 | } |
| 153 | |
| 154 | // 聚合写入, 减少syscall.write调用次数 |
| 155 | // Aggregate writes, reducing the number of syscall.write calls |