sergey-chugunov-1985 commented on code in PR #12380:
URL: https://github.com/apache/ignite/pull/12380#discussion_r2429446249
##########
modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/messages/HandshakeMessage.java:
##########
@@ -17,37 +17,36 @@
package org.apache.ignite.spi.communication.tcp.messages;
-import java.nio.ByteBuffer;
import java.util.UUID;
-import org.apache.ignite.internal.IgniteCodeGeneratingFail;
+import org.apache.ignite.internal.Order;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
/**
* Handshake message.
*/
-@IgniteCodeGeneratingFail
public class HandshakeMessage implements Message {
/** Message body size in bytes. */
- private static final int MESSAGE_SIZE = 36;
+ private static final int MESSAGE_SIZE = 36 + 1;
Review Comment:
```suggestion
private static final int MESSAGE_SIZE = 36 + 1; // additional byte for
null flag of UUID value.
```
##########
modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/internal/TcpHandshakeExecutor.java:
##########
@@ -140,12 +161,21 @@ ByteBuffer receiveNodeId() throws IgniteCheckedException {
if (msgType == HANDSHAKE_WAIT_MSG_TYPE)
return null;
+
+ assert msgType == TcpCommunicationSpi.NODE_ID_MSG_TYPE;
}
totalBytes += readBytes;
}
- return buf;
+ buf.position(DIRECT_TYPE_SIZE);
+
+ NodeIdMessage nodeIdMsg = new NodeIdMessage();
+
+ msgFactory.serializer(nodeIdMsg.directType()).readFrom(nodeIdMsg,
buf, reader);
Review Comment:
We could use `NODE_ID_MSG_TYPE` constant here instead of calling a method on
a message object.
Also as this method only reads NodeIdMessage messages, this lookup for a
serializer is unnecessary: we could save this serializer in a field in
`BlockingTransport` constructor and reuse it.
--
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]