ruanwenjun commented on code in PR #13013:
URL:
https://github.com/apache/dolphinscheduler/pull/13013#discussion_r1033060793
##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/ServerNodeManager.java:
##########
@@ -201,13 +203,25 @@ public void notify(Event event) {
}
private void syncSingleWorkerNodeInfo(String workerAddress,
WorkerHeartBeat info) {
+ if (!NetUtils.isLegalAddress(workerAddress)) {
Review Comment:
I don't think this is needed.
##########
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java:
##########
@@ -332,4 +334,35 @@ private static NetworkInterface
findOuterAddress(List<NetworkInterface> validNet
return networkInterface;
}
+ /**
+ * check if address is legal address, a legal address should be ip:port
+ * @param ipAndPortAddress address to check
+ * @return true if address is legal
+ */
+ public static boolean isLegalAddress(String ipAndPortAddress) {
+ if (StringUtils.isEmpty(ipAndPortAddress)) {
+ return false;
+ }
+ String[] ipAndPort = ipAndPortAddress.split(":");
+ if (ipAndPort.length != 2) {
+ return false;
+ }
+ return isValidIPv4Address(ipAndPort[0]) && isValidPort(ipAndPort[1]);
Review Comment:
Can this work on ipv6?
--
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]