Skip to content

Commit

Permalink
Fixes #5931 - SslConnection should implement getBytesIn()/getBytesOut().
Browse files Browse the repository at this point in the history
The TimeoutException message always references the original timeout.

Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Jun 3, 2021
1 parent cb2d57b commit 7ef65d5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public void onComplete(Result result)
}
else
{
TimeoutException failure = new TimeoutException("Total timeout " + request.getTimeout() + " ms elapsed");
TimeoutException failure = new TimeoutException("Total timeout " + request.getConversation().getTimeout() + " ms elapsed");
forwardFailureComplete(request, failure, response, failure);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;
import java.util.concurrent.ConcurrentLinkedDeque;

import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.api.Response;
import org.eclipse.jetty.util.AttributesMap;
import org.eclipse.jetty.util.log.Log;
Expand Down Expand Up @@ -143,6 +144,20 @@ public void updateResponseListeners(Response.ResponseListener overrideListener)
this.listeners = listeners;
}

/**
* <p>Returns the total timeout for the conversation.</p>
* <p>The conversation total timeout is the total timeout
* of the first request in the conversation.</p>
*
* @return the total timeout of the conversation
* @see Request#getTimeout()
*/
public long getTimeout()
{
HttpExchange firstExchange = exchanges.peekFirst();
return firstExchange == null ? 0 : firstExchange.getRequest().getTimeout();
}

public boolean abort(Throwable cause)
{
HttpExchange exchange = exchanges.peekLast();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private Request sendRedirect(HttpRequest httpRequest, Response response, Respons
}
else
{
TimeoutException failure = new TimeoutException("Total timeout " + httpRequest.getTimeout() + " ms elapsed");
TimeoutException failure = new TimeoutException("Total timeout " + httpRequest.getConversation().getTimeout() + " ms elapsed");
fail(httpRequest, failure, response);
return null;
}
Expand Down

0 comments on commit 7ef65d5

Please sign in to comment.