Fixed completeHeader() to just not attempt to detect the close state.

This is needed because the buffer to write may be big, and while it's
the only buffer, it may take multiple writes to be written.
If it takes more than one write, we risk to mark the first frame as closed
and subsequent frames cannot be written.

Fixed flush() to loop until the whole content has been flushed.
This commit is contained in:
Simone Bordet 2012-06-04 16:43:54 +02:00
parent e328cb8141
commit 3b0076fc6a
1 changed files with 4 additions and 3 deletions

View File

@ -649,9 +649,9 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem
reply(stream, new ReplyInfo(headers, content == null));
if (content != null)
{
closed = allContentAdded || isAllContentWritten();
closed = false;
// Update HttpGenerator fields so that they remain consistent
_state = closed ? HttpGenerator.STATE_END : HttpGenerator.STATE_CONTENT;
_state = HttpGenerator.STATE_CONTENT;
}
else
{
@ -693,12 +693,13 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem
try
{
Buffer content = getContentBuffer();
if (content != null)
while (content != null)
{
DataInfo dataInfo = toDataInfo(content, closed);
logger.debug("HTTP < {} bytes of content", dataInfo.length());
stream.data(dataInfo).get(maxIdleTime, TimeUnit.MILLISECONDS);
content.clear();
content = getContentBuffer();
}
}
catch (TimeoutException x)