Accounting for the session flow control window in case of reset streams.
This commit is contained in:
parent
728a7c3442
commit
09d54eacab
|
@ -30,7 +30,7 @@ public interface FlowControl
|
|||
|
||||
public void onWindowUpdate(ISession session, IStream stream, WindowUpdateFrame frame);
|
||||
|
||||
public void onDataReceived(IStream stream, int length);
|
||||
public void onDataReceived(ISession session, IStream stream, int length);
|
||||
|
||||
public void onDataConsumed(IStream stream, int length);
|
||||
|
||||
|
|
|
@ -78,17 +78,19 @@ public class HTTP2FlowControl implements FlowControl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onDataReceived(IStream stream, int length)
|
||||
public void onDataReceived(ISession session, IStream stream, int length)
|
||||
{
|
||||
ISession session = stream.getSession();
|
||||
int oldSize = session.updateRecvWindow(-length);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Updated session recv window {} -> {} for {}", oldSize, oldSize - length, session);
|
||||
|
||||
if (stream != null)
|
||||
{
|
||||
oldSize = stream.updateRecvWindow(-length);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Updated stream recv window {} -> {} for {}", oldSize, oldSize - length, stream);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataConsumed(IStream stream, int length)
|
||||
|
|
|
@ -129,16 +129,19 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
|
|||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Received {}", frame);
|
||||
|
||||
int streamId = frame.getStreamId();
|
||||
final IStream stream = getStream(streamId);
|
||||
|
||||
// SPEC: the session window must be updated even if the stream is null.
|
||||
// The flow control length includes the padding bytes.
|
||||
final int flowControlLength = frame.remaining() + frame.padding();
|
||||
flowControl.onDataReceived(this, stream, flowControlLength);
|
||||
|
||||
if (stream != null)
|
||||
{
|
||||
stream.updateClose(frame.isEndStream(), false);
|
||||
|
||||
// The flow control length includes the padding bytes.
|
||||
final int flowControlLength = frame.remaining() + frame.padding();
|
||||
flowControl.onDataReceived(stream, flowControlLength);
|
||||
|
||||
if (getRecvWindow() < 0)
|
||||
{
|
||||
close(ErrorCodes.FLOW_CONTROL_ERROR, "session_window_exceeded", disconnectOnFailure);
|
||||
|
|
Loading…
Reference in New Issue