in src/main/java/com/twitter/whiskey/net/SpdySession.java [506:551]
public void readWindowUpdateFrame(int streamId, int deltaWindowSize) {
/*
* SPDY WINDOW_UPDATE frame processing requirements:
*
* Receivers of a WINDOW_UPDATE that cause the window size to exceed 2^31
* must send a RST_STREAM with the status code FLOW_CONTROL_ERROR.
*
* Sender should ignore all WINDOW_UPDATE frames associated with a stream
* after sending the last frame for the stream.
*/
if (streamId == SPDY_SESSION_STREAM_ID) {
// Check for numerical overflow
if (sessionSendWindow > Integer.MAX_VALUE - deltaWindowSize) {
closeWithError(new SpdySessionException("session send window exceeded max value"));
return;
}
sessionSendWindow += deltaWindowSize;
for (SpdyStream stream : activeStreams) {
if (!stream.isClosedLocally()) sendData(stream);
if (sessionSendWindow == 0) break;
}
return;
}
SpdyStream stream = activeStreams.get(streamId);
// Ignore frames for non-existent or half-closed streams
if (stream == null || stream.isClosedLocally()) {
return;
}
// Check for numerical overflow
if (stream.getSendWindow() > Integer.MAX_VALUE - deltaWindowSize) {
sendRstStream(streamId, SPDY_STREAM_FLOW_CONTROL_ERROR);
activeStreams.remove(stream);
stream.close(new SpdyStreamException(SPDY_STREAM_FLOW_CONTROL_ERROR));
}
stream.increaseSendWindow(deltaWindowSize);
if (!stream.isClosedLocally()) {
sendData(stream);
}
}