You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/04/28 14:11:19 UTC

[pulsar] 08/15: Improve skipping of DNS resolution when creating AuthenticationDataHttp instance (#15228)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 3d8101f7ef4b94ecf700dbf8832645d2ceabaccc
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Wed Apr 20 11:54:51 2022 +0300

    Improve skipping of DNS resolution when creating AuthenticationDataHttp 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 e71b98ae157c4c108802661eaa72913e9c9e0bef)
---
 .../apache/pulsar/broker/authentication/AuthenticationDataHttp.java  | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationDataHttp.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationDataHttp.java
index 9ffb29c0376..8a8dda2f177 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationDataHttp.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationDataHttp.java
@@ -18,7 +18,6 @@
  */
 package org.apache.pulsar.broker.authentication;
 
-import io.netty.util.NetUtil;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 
@@ -36,9 +35,7 @@ public class AuthenticationDataHttp implements AuthenticationDataSource {
             throw new IllegalArgumentException();
         }
         this.request = request;
-        this.remoteAddress =
-                new InetSocketAddress(NetUtil.createInetAddressFromIpAddressString(request.getRemoteAddr()),
-                        request.getRemotePort());
+        this.remoteAddress = InetSocketAddress.createUnresolved(request.getRemoteAddr(), request.getRemotePort());
     }
 
     /*