onData is invoked when some data frame is received. It updates pendingData.
(n uint32)
| 172 | |
| 173 | // onData is invoked when some data frame is received. It updates pendingData. |
| 174 | func (f *inFlow) onData(n uint32) error { |
| 175 | f.mu.Lock() |
| 176 | defer f.mu.Unlock() |
| 177 | |
| 178 | f.pendingData += n |
| 179 | if f.pendingData+f.pendingUpdate > f.limit+f.delta { |
| 180 | limit := f.limit |
| 181 | rcvd := f.pendingData + f.pendingUpdate |
| 182 | return fmt.Errorf("received %d-bytes data exceeding the limit %d bytes", rcvd, limit) |
| 183 | } |
| 184 | return nil |
| 185 | } |
| 186 | |
| 187 | // onRead is invoked when the application reads the data. It returns the window size |
| 188 | // to be sent to the peer. |
no test coverage detected