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 (apache#15228)

- improves solution added in apache#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 committed Apr 20, 2022
1 parent be59a4e commit 6069c79
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 @@ -34,9 +33,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 6069c79

Please sign in to comment.