SetRwndSize dynamically updates the receive window size
(rwndSize int)
| 249 | |
| 250 | // SetRwndSize dynamically updates the receive window size |
| 251 | func (sm *StreamManager) SetRwndSize(rwndSize int) error { |
| 252 | sm.lock.Lock() |
| 253 | defer sm.lock.Unlock() |
| 254 | if rwndSize < 0 { |
| 255 | return fmt.Errorf("rwndSize cannot be negative") |
| 256 | } |
| 257 | if !sm.connected { |
| 258 | return fmt.Errorf("not connected") |
| 259 | } |
| 260 | sm.rwndSize = rwndSize |
| 261 | effectiveWindow := sm.cwndSize |
| 262 | if sm.rwndSize < effectiveWindow { |
| 263 | effectiveWindow = sm.rwndSize |
| 264 | } |
| 265 | sm.buf.SetEffectiveWindow(true, effectiveWindow) |
| 266 | sm.drainCond.Signal() |
| 267 | return nil |
| 268 | } |
| 269 | |
| 270 | // Close shuts down the sender loop. The reader loop will exit on its next iteration |
| 271 | // or when the underlying reader is closed. |
no test coverage detected