423974 - Optimize flow control.

Don't send the window update if the stream is closed.
This commit is contained in:
Simone Bordet 2015-03-11 17:11:16 +01:00
parent 560ec6301e
commit 1dbf2be343
1 changed files with 13 additions and 5 deletions

View File

@ -52,11 +52,19 @@ public class SimpleFlowControlStrategy extends AbstractFlowControlStrategy
Frame[] streamFrame = Frame.EMPTY_ARRAY;
if (stream != null)
{
streamFrame = new Frame[1];
streamFrame[0] = new WindowUpdateFrame(stream.getId(), length);
stream.updateRecvWindow(length);
if (LOG.isDebugEnabled())
LOG.debug("Data consumed, increased stream recv window by {} for {}", length, stream);
if (stream.isClosed())
{
if (LOG.isDebugEnabled())
LOG.debug("Data consumed, ignoring update stream recv window by {} for closed {}", length, stream);
}
else
{
streamFrame = new Frame[1];
streamFrame[0] = new WindowUpdateFrame(stream.getId(), length);
stream.updateRecvWindow(length);
if (LOG.isDebugEnabled())
LOG.debug("Data consumed, increased stream recv window by {} for {}", length, stream);
}
}
session.control(stream, Callback.Adapter.INSTANCE, sessionFrame, streamFrame);