Skip to content

Commit

Permalink
JVMCBC-151: fix broken query keepAlive
Browse files Browse the repository at this point in the history
Motivation
----------
In QueryHandler, keepalive is broken: it is marked as finishedDecoding
too soon, not taking into account that the first response could not be
a LastHttpComponent. This can break the handling of query requests.

Modifications
-------------
Only finish the decoding and issue the response for keepalive when we
received a LastHttpComponent.

Results
-------
Keepalive doesn't interfere with query handling anymore.

Change-Id: I445f86596e629e1d0874f4606978e50019b09666
Reviewed-on: http://review.couchbase.org/46943
Tested-by: Simon Baslé <simon@couchbase.com>
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
  • Loading branch information
simonbasle committed Feb 17, 2015
1 parent 7bed13b commit 814fbf1
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -192,10 +192,12 @@ protected CouchbaseResponse decodeResponse(final ChannelHandlerContext ctx, fina
}

if (currentRequest() instanceof KeepAliveRequest) {
response = new KeepAliveResponse(statusFromCode(responseHeader.getStatus().code()), currentRequest());
responseContent.clear();
responseContent.discardReadBytes();
finishedDecoding();
if (msg instanceof LastHttpContent) {
response = new KeepAliveResponse(statusFromCode(responseHeader.getStatus().code()), currentRequest());
responseContent.clear();
responseContent.discardReadBytes();
finishedDecoding();
}
} else if (msg instanceof HttpContent) {
responseContent.writeBytes(((HttpContent) msg).content());
boolean lastChunk = msg instanceof LastHttpContent;
Expand Down

0 comments on commit 814fbf1

Please sign in to comment.