#3073: Release HAProxyMessage after read

This commit is contained in:
_tomcraft 2021-04-28 08:07:17 +10:00 committed by md_5
parent 830ee8f27d
commit ac371bb596
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -81,6 +81,8 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
if ( msg instanceof HAProxyMessage ) if ( msg instanceof HAProxyMessage )
{ {
HAProxyMessage proxy = (HAProxyMessage) msg; HAProxyMessage proxy = (HAProxyMessage) msg;
try
{
InetSocketAddress newAddress = new InetSocketAddress( proxy.sourceAddress(), proxy.sourcePort() ); InetSocketAddress newAddress = new InetSocketAddress( proxy.sourceAddress(), proxy.sourcePort() );
ProxyServer.getInstance().getLogger().log( Level.FINE, "Set remote address via PROXY {0} -> {1}", new Object[] ProxyServer.getInstance().getLogger().log( Level.FINE, "Set remote address via PROXY {0} -> {1}", new Object[]
@ -89,6 +91,10 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
} ); } );
channel.setRemoteAddress( newAddress ); channel.setRemoteAddress( newAddress );
} finally
{
proxy.release();
}
return; return;
} }