Skip to content

Commit

Permalink
Intermittent test failure with keep-alive enabled fixed (#2238)
Browse files Browse the repository at this point in the history
Signed-off-by: David Kral <david.k.kral@oracle.com>
  • Loading branch information
Verdent authored Aug 7, 2020
1 parent 96421c7 commit b5606e7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,14 @@ Single<Void> close() {
WebClientServiceResponse clientServiceResponse = channel.attr(SERVICE_RESPONSE).get();
CompletableFuture<WebClientServiceResponse> requestComplete = channel.attr(COMPLETED).get();
requestComplete.complete(clientServiceResponse);
channel.config().setAutoRead(true);
WebClientResponse response = channel.attr(RESPONSE).get();
String connection = response.headers().first(Http.Header.CONNECTION)
.orElseGet(HttpHeaderValues.CLOSE::toString);
if (connection.equals(HttpHeaderValues.CLOSE.toString())) {
ctx.close()
.addListener(future -> {
if (future.isSuccess()) {
LOGGER.finest(() -> "Response from has been closed.");
LOGGER.finest(() -> "Response from the server has been closed.");
cf.complete(null);
} else {
LOGGER.log(Level.SEVERE,
Expand All @@ -310,6 +309,7 @@ Single<Void> close() {
} else {
channel.attr(IN_USE).get().set(false);
cf.complete(null);
channel.read();
}
publisher.complete();
}
Expand Down

0 comments on commit b5606e7

Please sign in to comment.