Skip to content

Commit

Permalink
Inline duplicate variable declaration (#13763)
Browse files Browse the repository at this point in the history
Motivation:
I was going through the WebSocket code and found that a new
`HttpResponse` variable was declared referring to the same instance.

Modification:
Inlined duplicate variable declaration

Result:
Minor nit and comment cleanup
  • Loading branch information
hyperxpro committed Jan 11, 2024
1 parent 78639fa commit 7ad4c4b
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,9 @@ public void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise pr
protected void onHttpResponseWrite(ChannelHandlerContext ctx, HttpResponse response, ChannelPromise promise)
throws Exception {
List<WebSocketServerExtension> validExtensionsList = validExtensions.poll();
HttpResponse httpResponse = response;
//checking the status is faster than looking at headers
//so we do this first
if (HttpResponseStatus.SWITCHING_PROTOCOLS.equals(httpResponse.status())) {
handlePotentialUpgrade(ctx, promise, httpResponse, validExtensionsList);
// checking the status is faster than looking at headers so we do this first
if (HttpResponseStatus.SWITCHING_PROTOCOLS.equals(response.status())) {
handlePotentialUpgrade(ctx, promise, response, validExtensionsList);
}
super.write(ctx, response, promise);
}
Expand Down

0 comments on commit 7ad4c4b

Please sign in to comment.