Skip to content

Commit

Permalink
Add connection: close if the server is shut down
Browse files Browse the repository at this point in the history
Fixes #18890
  • Loading branch information
stuartwdouglas committed Jul 21, 2021
1 parent 9670e47 commit 5a73970
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

import io.netty.handler.codec.http.HttpHeaderNames;
import org.jboss.logging.Logger;

import io.netty.handler.codec.http.HttpResponseStatus;
Expand Down Expand Up @@ -40,7 +41,8 @@ public void handle(Void event) {
@Override
public void handle(HttpServerRequest event) {
if (!running) {
event.response().setStatusCode(HttpResponseStatus.SERVICE_UNAVAILABLE.code()).end();
event.response().setStatusCode(HttpResponseStatus.SERVICE_UNAVAILABLE.code())
.putHeader(HttpHeaderNames.CONNECTION,"close").end();
return;
}
currentRequestCount.incrementAndGet();
Expand Down

0 comments on commit 5a73970

Please sign in to comment.