Skip to content

Commit

Permalink
Improve skipping of DNS resolution when creating AuthenticationDataHt…
Browse files Browse the repository at this point in the history
…tp instance (#15228)

- improves solution added in #15221
  - It's better to use the JDK provided InetSocketAddress.createUnresolved method
    to prevent unnecessary DNS resolution

(cherry picked from commit e71b98a)
  • Loading branch information
lhotari authored and codelipenghui committed Apr 29, 2022
1 parent fab8c7c commit f91a920
Showing 1 changed file with 1 addition and 4 deletions.
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.pulsar.broker.authentication;

import io.netty.util.NetUtil;
import java.net.InetSocketAddress;
import java.net.SocketAddress;

Expand All @@ -36,9 +35,7 @@ public AuthenticationDataHttp(HttpServletRequest request) {
throw new IllegalArgumentException();
}
this.request = request;
this.remoteAddress =
new InetSocketAddress(NetUtil.createInetAddressFromIpAddressString(request.getRemoteAddr()),
request.getRemotePort());
this.remoteAddress = InetSocketAddress.createUnresolved(request.getRemoteAddr(), request.getRemotePort());
}

/*
Expand Down

0 comments on commit f91a920

Please sign in to comment.