Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhee17 committed Dec 9, 2024
1 parent 5e8111c commit 34392d4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public HttpResponseWrapper addResponse(@Nullable AbstractHttpRequestHandler requ
int id, DecodedHttpResponse res,
ClientRequestContext ctx, EventLoop eventLoop) {
final HttpResponseWrapper newRes =
new HttpResponseWrapper(requestHandler, res, eventLoop, ctx,
ctx.responseTimeoutMillis(), ctx.maxResponseLength());
new HttpResponseWrapper(requestHandler, res, eventLoop, ctx, ctx.maxResponseLength());
final HttpResponseWrapper oldRes = responses.put(id, newRes);
keepAliveHandler().increaseNumRequests();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,21 @@ class HttpResponseWrapper implements StreamWriter<HttpObject> {
private final EventLoop eventLoop;
private final ClientRequestContext ctx;
private final long maxContentLength;
private final long responseTimeoutMillis;

private boolean responseStarted;
private long contentLengthHeaderValue = -1;

private boolean done;
private boolean closed;

HttpResponseWrapper(@Nullable AbstractHttpRequestHandler requestHandler,
DecodedHttpResponse delegate, EventLoop eventLoop, ClientRequestContext ctx,
long responseTimeoutMillis, long maxContentLength) {
HttpResponseWrapper(@Nullable AbstractHttpRequestHandler requestHandler, DecodedHttpResponse delegate,
EventLoop eventLoop, ClientRequestContext ctx, long maxContentLength) {

this.requestHandler = requestHandler;
this.delegate = delegate;
this.eventLoop = eventLoop;
this.ctx = ctx;
this.maxContentLength = maxContentLength;
this.responseTimeoutMillis = responseTimeoutMillis;
}

void handle100Continue(ResponseHeaders responseHeaders) {
Expand Down Expand Up @@ -327,7 +325,6 @@ public String toString() {
.add("eventLoop", eventLoop)
.add("responseStarted", responseStarted)
.add("maxContentLength", maxContentLength)
.add("responseTimeoutMillis", responseTimeoutMillis)
.add("contentLengthHeaderValue", contentLengthHeaderValue)
.add("delegate", delegate)
.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ public HttpResponseWrapper addResponse(@Nullable AbstractHttpRequestHandler requ
int id, DecodedHttpResponse decodedHttpResponse,
ClientRequestContext ctx, EventLoop eventLoop) {
assert res == null;
res = new WebSocketHttp1ResponseWrapper(decodedHttpResponse, eventLoop, ctx,
ctx.responseTimeoutMillis(), ctx.maxResponseLength());
res = new WebSocketHttp1ResponseWrapper(decodedHttpResponse, eventLoop, ctx, ctx.maxResponseLength());
return res;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
final class WebSocketHttp1ResponseWrapper extends HttpResponseWrapper {

WebSocketHttp1ResponseWrapper(DecodedHttpResponse delegate,
EventLoop eventLoop, ClientRequestContext ctx,
long responseTimeoutMillis, long maxContentLength) {
super(null, delegate, eventLoop, ctx, responseTimeoutMillis, maxContentLength);
EventLoop eventLoop, ClientRequestContext ctx, long maxContentLength) {
super(null, delegate, eventLoop, ctx, maxContentLength);
WebSocketClientUtil.setClosingResponseTask(ctx, cause -> {
super.close(cause, false);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,7 @@ private DefaultClientRequestContext(DefaultClientRequestContext ctx,
log.startRequest();
// Cancel the original timeout and create a new scheduler for the derived context.
ctx.responseCancellationScheduler.cancelScheduled();
responseCancellationScheduler =
CancellationScheduler.ofClient(ctx.remainingTimeoutNanos());
responseCancellationScheduler = CancellationScheduler.ofClient(ctx.remainingTimeoutNanos());
writeTimeoutMillis = ctx.writeTimeoutMillis();
maxResponseLength = ctx.maxResponseLength();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ void originalResponseTimeoutRespected(long backoffMillis, long attemptMillis, lo
WebClient.builder(server.httpUri())
.responseTimeout(Duration.ofSeconds(timeoutSeconds))
.responseTimeoutMode(ResponseTimeoutMode.FROM_START)
.decorator((delegate, ctx, req) -> {
logger.info("ctx.responseTimeoutMillis: {}", ctx.responseTimeoutMillis());
return delegate.execute(ctx, req);
})
.decorator(
RetryingClient.builder(RetryRule.builder()
.onException()
Expand Down

0 comments on commit 34392d4

Please sign in to comment.