This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new 55fb9bb  ARTEMIS-3449: add some additional guarding following 
behaviour seen prior to ARTEMIS 3465 fix
55fb9bb is described below

commit 55fb9bb540f5e4a00dcbbb62d2962a06e5c20c08
Author: Robbie Gemmell <[email protected]>
AuthorDate: Fri Sep 10 11:41:21 2021 +0100

    ARTEMIS-3449: add some additional guarding following behaviour seen prior 
to ARTEMIS 3465 fix
---
 .../artemis/protocol/amqp/proton/ProtonServerSenderContext.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
 
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
index da09c6c..71c379a 100644
--- 
a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
+++ 
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerSenderContext.java
@@ -678,11 +678,15 @@ public class ProtonServerSenderContext extends 
ProtonInitializable implements Pr
          if (writableBytes != 0) {
             final int writtenBytes = frameBuffer.writerIndex();
             readSize = 
context.readInto(frameBuffer.internalNioBuffer(writtenBytes, writableBytes));
-            frameBuffer.writerIndex(writtenBytes + readSize);
+            if (readSize > 0) {
+               frameBuffer.writerIndex(writtenBytes + readSize);
+            }
          }
 
          sender.send(new NettyReadable(frameBuffer));
-         position += readSize;
+         if (readSize > 0) {
+            position += readSize;
+         }
          connection.instantFlush();
          return true;
       }

Reply via email to