Dedeepya-T commented on a change in pull request #71:
URL: https://github.com/apache/qpid-broker-j/pull/71#discussion_r529296446
##########
File path:
broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerConnectionDelegate.java
##########
@@ -427,6 +432,54 @@ public void sessionAttach(final ServerConnection
serverConnection, final Session
}
}
+ private String getPeerSessionName(final byte[] attachName)
+ {
+ String peerSessionName = "";
+ try
+ {
+ peerSessionName = UUID.nameUUIDFromBytes(attachName).toString();
+ }
+ catch (Exception e)
+ {
+ peerSessionName = getPeerSessionNameUsingSha(attachName);
+ }
+ return peerSessionName;
+ }
+
+ private String getPeerSessionNameUsingSha(final byte[] attachName)
+ {
+ final String peerSessionName;
+ final MessageDigest hasher;
+ try
+ {
+ hasher = MessageDigest.getInstance(MESSAGE_DIGEST_SHA256);
+ // Split the hash into two parts: MSB and LSB
+ long msb = toNumber(attachName, 0, 8);
+ long lsb = toNumber(attachName, 8, 16);
+
+ // Apply version and variant bits (required for RFC-4122
compliance)
+ msb = (msb & 0xffffffffffff0fffL) | (5 & 0x0f) << 12;
+ lsb = (lsb & 0x3fffffffffffffffL) | 0x8000000000000000L;
+
+ peerSessionName = new UUID(msb, lsb).toString();
Review comment:
Done!
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]