alex-plekhanov commented on a change in pull request #7616: IGNITE-12853: Introduced features for the thin client protocol URL: https://github.com/apache/ignite/pull/7616#discussion_r409862650
########## File path: modules/core/src/main/java/org/apache/ignite/internal/client/thin/TcpClientChannel.java ########## @@ -446,39 +463,46 @@ private void handshakeRes(String user, String pwd, Map<String, String> userAttrs BinaryInputStream res = new BinaryHeapInputStream(dataInput.read(resSize)); - try (BinaryReaderExImpl r = new BinaryReaderExImpl(null, res, null, true)) { - if (res.readBoolean()) { // Success flag. - if (ver.compareTo(V1_4_0) >= 0) - srvNodeId = r.readUuid(); // Server node UUID. - } - else { - ProtocolVersion srvVer = new ProtocolVersion(res.readShort(), res.readShort(), res.readShort()); + try (BinaryReaderExImpl reader = new BinaryReaderExImpl(null, res, null, true)) { + boolean success = res.readBoolean(); - String err = r.readString(); + if (success) { + byte[] features = new byte[0]; + if (ProtocolContext.isFeatureSupported(proposedVer, ProtocolVersionFeature.BITMAP_FEATURES)) + features = reader.readByteArray(); + + protocolCtx = new ProtocolContext(proposedVer, ProtocolBitmaskFeature.enumSet(features)); + + if (protocolCtx.isFeatureSupported(ProtocolVersionFeature.PARTITION_AWARENESS)) { + // Reading server UUID + srvNodeId = reader.readUuid(); + } + } else { + ProtocolVersion srvVer = new ProtocolVersion(res.readShort(), res.readShort(), res.readShort()); + + String err = reader.readString(); int errCode = ClientStatus.FAILED; if (res.remaining() > 0) - errCode = r.readInt(); + errCode = reader.readInt(); if (errCode == ClientStatus.AUTH_FAILED) throw new ClientAuthenticationException(err); - else if (ver.equals(srvVer)) + else if (proposedVer.equals(srvVer)) throw new ClientProtocolError(err); else if (!supportedVers.contains(srvVer) || - (srvVer.compareTo(V1_1_0) < 0 && user != null && !user.isEmpty())) + (srvVer.compareTo(V1_1_0) < 0 && !F.isEmpty(user))) Review comment: `srvVer.compareTo(V1_1_0) < 0` -> `!ProtocolContext.isFeatureSupported(srvVer, ProtocolVersionFeature.AUTHORIZATION)` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services