ivanzlenko commented on code in PR #6093:
URL: https://github.com/apache/ignite-3/pull/6093#discussion_r2161419939


##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/NetworkAddressesSerializer.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.network.serialization;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.io.IgniteDataInput;
+import org.apache.ignite.internal.util.io.IgniteDataOutput;
+import org.apache.ignite.internal.versioned.VersionedSerialization;
+import org.apache.ignite.internal.versioned.VersionedSerializer;
+import org.apache.ignite.network.NetworkAddress;
+
+/**
+ * {@link VersionedSerializer} for network addresses (represented with {@code 
Collection<NetworkAddress} instances).

Review Comment:
   MIssing >



##########
modules/network/src/main/java/org/apache/ignite/internal/network/MulticastNodeFinder.java:
##########
@@ -198,9 +198,10 @@ private void waitForResponses(byte[] responseBuffer, 
MulticastSocket socket, Set
             try {
                 byte[] data = receiveDatagramData(socket, responsePacket);
 
-                InetSocketAddress address = ByteUtils.fromBytes(data);
-                if (!address.equals(localAddressToAdvertise)) {
-                    discovered.add(NetworkAddress.from(address));
+                Collection<NetworkAddress> addresses = 
NetworkAddressesSerializer.deserialize(data);

Review Comment:
   How's this work? We just reading the first address from the list?



##########
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/NetworkAddressesSerializer.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.network.serialization;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.io.IgniteDataInput;
+import org.apache.ignite.internal.util.io.IgniteDataOutput;
+import org.apache.ignite.internal.versioned.VersionedSerialization;
+import org.apache.ignite.internal.versioned.VersionedSerializer;
+import org.apache.ignite.network.NetworkAddress;
+
+/**
+ * {@link VersionedSerializer} for network addresses (represented with {@code 
Collection<NetworkAddress} instances).
+ */
+public class NetworkAddressesSerializer extends 
VersionedSerializer<Collection<NetworkAddress>> {
+    /** Serializer instance. */
+    public static final NetworkAddressesSerializer INSTANCE = new 
NetworkAddressesSerializer();
+
+    private final NetworkAddressSerializer networkAddressSerializer = 
NetworkAddressSerializer.INSTANCE;
+
+    @Override
+    protected void writeExternalData(Collection<NetworkAddress> addresses, 
IgniteDataOutput out) throws IOException {
+        out.writeVarInt(addresses.size());
+        for (NetworkAddress address : addresses) {
+            networkAddressSerializer.writeExternal(address, out);
+        }
+    }
+
+    @Override
+    protected Collection<NetworkAddress> readExternalData(byte protoVer, 
IgniteDataInput in) throws IOException {

Review Comment:
   It would be better to limit this collection to set



##########
modules/network/src/integrationTest/java/org/apache/ignite/internal/network/scalecube/ItMulticastNodeFinderTest.java:
##########
@@ -118,14 +121,19 @@ void testFindNodes(int ttl) {
         }
     }
 
-    private static NodeFinder startMulticastNodeFinder(NetworkAddress addr, 
int ttl) {
+    private static NodeFinder startMulticastNodeFinder(NetworkAddress addr, 
int ttl) throws SocketException {

Review Comment:
   addr parameter not used anymore



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to