(n int)
| 67 | } |
| 68 | |
| 69 | func (w *writeQuota) realReplenish(n int) { |
| 70 | sz := int32(n) |
| 71 | newQuota := atomic.AddInt32(&w.quota, sz) |
| 72 | previousQuota := newQuota - sz |
| 73 | if previousQuota <= 0 && newQuota > 0 { |
| 74 | select { |
| 75 | case w.ch <- struct{}{}: |
| 76 | default: |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | type trInFlow struct { |
| 82 | limit uint32 |
no outgoing calls