mivanac commented on a change in pull request #6063:
URL: https://github.com/apache/geode/pull/6063#discussion_r588139234



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
##########
@@ -1550,12 +1568,63 @@ public void refuseHandshake(OutputStream out, String 
message, byte exception) th
     out.flush();
   }
 
-  private boolean handOffQueueInitialization(Socket socket, CommunicationMode 
communicationMode) {
+  @Override
+  public void refuseHandshake(OutputStream out, String message, byte exception,
+      NioSslEngine sslEngine, Socket socket) throws IOException {
+    if (sslEngine == null) {
+      refuseHandshake(out, message, exception);
+      return;
+    }
+    try (ByteBufferOutputStream bbos =
+        new ByteBufferOutputStream(sslEngine.getPacketBufferSize())) {
+
+      DataOutputStream dos = new DataOutputStream(bbos);
+
+      // Write refused reply
+      dos.writeByte(exception);
+
+      // write dummy endpointType
+      dos.writeByte(0);
+      // write dummy queueSize
+      dos.writeInt(0);
+
+      // Write the server's member
+      HeapDataOutputStream memberDos = new 
HeapDataOutputStream(KnownVersion.CURRENT);
+      DataSerializer.writeObject(member, memberDos);
+      DataSerializer.writeByteArray(memberDos.toByteArray(), dos);
+      memberDos.close();
+
+      // Write the refusal message
+      if (message == null) {
+        message = "";
+      }
+      dos.writeUTF(message);
+
+      // Write dummy delta-propagation property value. This will never be read 
at
+      // receiver because the exception byte above will cause the receiver code
+      // throw an exception before the below byte could be read.
+      dos.writeBoolean(Boolean.TRUE);
+
+      bbos.flush();
+      ByteBuffer buffer = bbos.getContentBuffer();
+      try (final ByteBufferSharing outputSharing = sslEngine.wrap(buffer)) {
+        final ByteBuffer wrappedBuffer = outputSharing.getBuffer();
+        if (socket != null) {

Review comment:
       I will remove this.




----------------------------------------------------------------
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]


Reply via email to