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
lhotari authored Apr 20, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 1e9a1f0 commit e71b98a
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
*/
package org.apache.pulsar.broker.authentication;

import io.netty.util.NetUtil;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import javax.servlet.http.HttpServletRequest;
@@ -35,9 +34,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());
}

/*

0 comments on commit e71b98a

Please sign in to comment.