Skip to content

Commit

Permalink
Fixed ErrorResponseAndCallback succeeded() and failed() to call super…
Browse files Browse the repository at this point in the history
….failed() in all cases to complete the wrapped callback.

Signed-off-by: Simone Bordet <[email protected]>
  • Loading branch information
sbordet committed Jun 12, 2023
1 parent 0dbbdf5 commit 5ac57c1
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ public Runnable onRequest(MetaData.Request request)
if (idleTO >= 0 && _oldIdleTimeout != idleTO)
_stream.setIdleTimeout(idleTO);


// This is deliberately not serialized to allow a handler to block.
return _handlerInvoker;
}
Expand Down Expand Up @@ -1571,7 +1570,7 @@ public ErrorResponseAndCallback(ChannelRequest request, HttpStream stream, Throw
_request = request;
_stream = stream;
_failure = failure;
_status = 500;
_status = HttpStatus.INTERNAL_SERVER_ERROR_500;
}

@Override
Expand Down Expand Up @@ -1623,17 +1622,17 @@ public void succeeded()
if (needLastWrite)
{
_stream.send(_request._metaData, responseMetaData, true, null,
Callback.from(() -> httpChannelState._handlerInvoker.failed(failure),
Callback.from(() -> super.failed(failure),
x ->
{
if (ExceptionUtil.areNotAssociated(failure, x))
failure.addSuppressed(x);
httpChannelState._handlerInvoker.failed(failure);
super.failed(failure);
}));
}
else
{
httpChannelState._handlerInvoker.failed(failure);
super.failed(failure);
}
}

Expand Down Expand Up @@ -1667,13 +1666,7 @@ public void failed(Throwable x)
}
if (ExceptionUtil.areNotAssociated(failure, x))
failure.addSuppressed(x);
httpChannelState._handlerInvoker.failed(failure);
}

@Override
public String toString()
{
return "%s@%x".formatted(getClass().getSimpleName(), hashCode());
super.failed(failure);
}
}

Expand Down

0 comments on commit 5ac57c1

Please sign in to comment.