gemmellr commented on code in PR #5950:
URL: https://github.com/apache/activemq-artemis/pull/5950#discussion_r2405945258


##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPTunneledCoreLargeMessageWriter.java:
##########
@@ -219,15 +219,14 @@ private boolean trySendDeliveryAnnotations(ByteBuf 
frameBuffer, NettyReadable fr
       for (; protonSender.getLocalState() != EndpointState.CLOSED && state == 
State.STREAMING_DELIVERY_ANNOTATIONS; ) {
          if (annotations != null && annotations.getValue() != null && 
!annotations.getValue().isEmpty()) {
             if (!connection.flowControl(this::resume)) {
-               break; // Resume will restart writing the headers section from 
where we left off.
+               break; // Resume will restart writing the delivery annotations 
section from where we left off.
             }
 
             final ByteBuf annotationsBuffer = 
getOrCreateDeliveryAnnotationsBuffer();
-            final int readSize = (int) Math.min(frameBuffer.writableBytes(), 
annotationsBuffer.readableBytes() - position);
+            final int readSize = Math.min(frameBuffer.writableBytes(), 
annotationsBuffer.readableBytes());
 
-            position += readSize;
-
-            annotationsBuffer.readBytes(frameBuffer, readSize);
+            
annotationsBuffer.readBytes(frameBuffer.internalNioBuffer(frameBuffer.writerIndex(),
 readSize));
+            frameBuffer.writerIndex(frameBuffer.writerIndex() + readSize);

Review Comment:
   Ok, that seems reasonable, I just couldnt see why the change happened so I 
asked :)  I see you later switched it out anyway though, so I'll just merge 
this as it is now.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to