Fix the leak in the WebSocketClientProtocolHandshakeHandler
Motivation: The WebSocketClientProtocolHandshakeHandler never releases the received handshake response. Modification: Release the message in a finally block. Result: No more leak
This commit is contained in:
parent
43681b5608
commit
a6b3fd8a72
@ -51,13 +51,18 @@ class WebSocketClientProtocolHandshakeHandler extends ChannelInboundHandlerAdapt
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handshaker.isHandshakeComplete()) {
|
FullHttpResponse response = (FullHttpResponse) msg;
|
||||||
handshaker.finishHandshake(ctx.channel(), (FullHttpResponse) msg);
|
try {
|
||||||
ctx.fireUserEventTriggered(
|
if (!handshaker.isHandshakeComplete()) {
|
||||||
WebSocketClientProtocolHandler.ClientHandshakeStateEvent.HANDSHAKE_COMPLETE);
|
handshaker.finishHandshake(ctx.channel(), response);
|
||||||
ctx.pipeline().remove(this);
|
ctx.fireUserEventTriggered(
|
||||||
return;
|
WebSocketClientProtocolHandler.ClientHandshakeStateEvent.HANDSHAKE_COMPLETE);
|
||||||
|
ctx.pipeline().remove(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new IllegalStateException("WebSocketClientHandshaker should have been non finished yet");
|
||||||
|
} finally {
|
||||||
|
response.release();
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("WebSocketClientHandshaker should have been non finished yet");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user