412814 - HttpClient calling CompleteListener.onComplete() twice.

The problem was stemming from the HttpSender completing the response,
but the response was actually completed by HttpReceiver, resulting in the
double call to onComplete().

Now HttpSender checks whether it was able to complete the response, and
only in that case calls the onComplete() callback.
This commit is contained in:
Simone Bordet 2013-07-23 18:40:26 +02:00
parent 4837b75eec
commit 108aa247b4
1 changed files with 7 additions and 3 deletions

View File

@ -540,9 +540,13 @@ public class HttpSender implements AsyncContentProvider.Listener
boolean notCommitted = isBeforeCommit(current);
if (result == null && notCommitted && request.getAbortCause() == null)
{
result = exchange.responseComplete(failure).getReference();
exchange.terminateResponse();
LOG.debug("Failed on behalf {}", exchange);
completion = exchange.responseComplete(failure);
if (completion.isMarked())
{
result = completion.getReference();
exchange.terminateResponse();
LOG.debug("Failed on behalf {}", exchange);
}
}
if (result != null)