MCPcopy
hub / github.com/grpc/grpc-go / onRead

Method onRead

internal/transport/flowcontrol.go:189–211  ·  view source on GitHub ↗

onRead is invoked when the application reads the data. It returns the window size to be sent to the peer.

(n uint32)

Source from the content-addressed store, hash-verified

187// onRead is invoked when the application reads the data. It returns the window size
188// to be sent to the peer.
189func (f *inFlow) onRead(n uint32) uint32 {
190 f.mu.Lock()
191 defer f.mu.Unlock()
192
193 if f.pendingData == 0 {
194 return 0
195 }
196 f.pendingData -= n
197 if n > f.delta {
198 n -= f.delta
199 f.delta = 0
200 } else {
201 f.delta -= n
202 n = 0
203 }
204 f.pendingUpdate += n
205 if f.pendingUpdate >= f.limit/4 {
206 wu := f.pendingUpdate
207 f.pendingUpdate = 0
208 return wu
209 }
210 return 0
211}

Callers 4

updateWindowMethod · 0.80
handleDataMethod · 0.80
updateWindowMethod · 0.80
handleDataMethod · 0.80

Calls 2

LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected