changfubai commented on a change in pull request #8769:
URL: https://github.com/apache/dubbo/pull/8769#discussion_r706273405



##########
File path: 
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java
##########
@@ -756,17 +756,17 @@ private Integer findConfigedPorts(ProtocolConfig 
protocolConfig,
             }
         }
 
-        // save bind port, used as url's key later
-        map.put(BIND_PORT_KEY, String.valueOf(portToBind));
-
         // registry port, not used as bind port by default
         String portToRegistryStr = getValueFromConfig(protocolConfig, 
DUBBO_PORT_TO_REGISTRY);
         Integer portToRegistry = parsePort(portToRegistryStr);
-        if (portToRegistry == null) {
-            portToRegistry = portToBind;
+        if (portToRegistry != null) {
+            portToBind = portToRegistry;
         }
 
-        return portToRegistry;
+        // save bind port, used as url's key later
+        map.put(BIND_PORT_KEY, String.valueOf(portToBind));

Review comment:
       if registryPort is not null,  make bindPort = registryPort
   put bindPort into map.
   return bindPort.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to