Merge remote-tracking branch 'origin/copyByteBuffer'
This commit is contained in:
commit
71d7c6ff08
|
@ -96,12 +96,12 @@ public class HttpTransportOverSPDY implements HttpTransport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean noContent = BufferUtil.isEmpty(content);
|
boolean hasContent = !BufferUtil.isEmpty(content);
|
||||||
boolean close = noContent && lastContent;
|
boolean close = !hasContent && lastContent;
|
||||||
reply(stream, new ReplyInfo(headers, close));
|
reply(stream, new ReplyInfo(headers, close));
|
||||||
|
|
||||||
if (!noContent)
|
if (hasContent)
|
||||||
stream.data(new ByteBufferDataInfo(content, lastContent));
|
sendToStream(content, lastContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,7 +111,20 @@ public class HttpTransportOverSPDY implements HttpTransport
|
||||||
// TODO work out if we can avoid double calls for lastContent==true
|
// TODO work out if we can avoid double calls for lastContent==true
|
||||||
if (stream.isClosed() && BufferUtil.isEmpty(content) && lastContent)
|
if (stream.isClosed() && BufferUtil.isEmpty(content) && lastContent)
|
||||||
return;
|
return;
|
||||||
stream.data(new ByteBufferDataInfo(content, lastContent));
|
|
||||||
|
sendToStream(content, lastContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendToStream(ByteBuffer content, boolean lastContent)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
stream.data(new ByteBufferDataInfo(content, lastContent)).get();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
endPoint.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue