More simplifications for the send() implementation.

This commit is contained in:
Simone Bordet 2014-09-18 11:50:18 +02:00
parent 0acee9851f
commit 418a493337
1 changed files with 2 additions and 3 deletions

View File

@ -78,13 +78,12 @@ public class HttpTransportOverHTTP2 implements HttpTransport
// info == null | content == 0 | last = false => noop // info == null | content == 0 | last = false => noop
boolean hasContent = BufferUtil.hasContent(content) && !isHeadRequest; boolean hasContent = BufferUtil.hasContent(content) && !isHeadRequest;
boolean sendContent = hasContent || (info == null && lastContent);
if (info != null) if (info != null)
{ {
if (commit.compareAndSet(false, true)) if (commit.compareAndSet(false, true))
{ {
if (sendContent) if (hasContent)
{ {
commit(info, false, commitCallback); commit(info, false, commitCallback);
send(content, lastContent, callback); send(content, lastContent, callback);
@ -101,7 +100,7 @@ public class HttpTransportOverHTTP2 implements HttpTransport
} }
else else
{ {
if (sendContent) if (hasContent || lastContent)
{ {
send(content, lastContent, callback); send(content, lastContent, callback);
} }