Simplified/Improved handling of parser return values.

This commit is contained in:
Simone Bordet 2014-05-20 21:23:23 +02:00
parent 4e3118f5b1
commit 4f67993b61
1 changed files with 11 additions and 7 deletions

View File

@ -126,7 +126,7 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
{
try
{
if (!parse(buffer))
if (parse(buffer))
return false;
int read = endPoint.fill(buffer);
@ -134,7 +134,7 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
LOG.debug("Read {} bytes from {}", read, endPoint);
if (read > 0)
{
if (!parse(buffer))
if (parse(buffer))
return false;
}
else if (read == 0)
@ -159,7 +159,7 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
private boolean parse(ByteBuffer buffer)
{
return !parser.parse(buffer);
return parser.parse(buffer);
}
private void shutdown()
@ -199,9 +199,11 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
// from an onFailure() handler or by blocking code waiting for completion.
getHttpDestination().close(this);
getEndPoint().shutdownOutput();
LOG.debug("{} oshut", this);
if (LOG.isDebugEnabled())
LOG.debug("{} oshut", this);
getEndPoint().close();
LOG.debug("{} closed", this);
if (LOG.isDebugEnabled())
LOG.debug("{} closed", this);
abort(failure);
}
@ -347,7 +349,8 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
@Override
public void resume()
{
LOG.debug("Content consumed asynchronously, resuming processing");
if (LOG.isDebugEnabled())
LOG.debug("Content consumed asynchronously, resuming processing");
process();
}
@ -357,7 +360,8 @@ public class HttpConnectionOverFCGI extends AbstractConnection implements Connec
close(x);
}
};
channel.content(buffer, callback);
if (!channel.content(buffer, callback))
return true;
return callback.tryComplete();
}
else