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

kgiusti pushed a commit to branch dev-protocol-adaptors-2
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/dev-protocol-adaptors-2 by 
this push:
     new 943a819  DISPATCH-1856: avoid adding empty message buffer
943a819 is described below

commit 943a819eea5e16643867f04ca25474f1117e8b7a
Author: Kenneth Giusti <kgiu...@apache.org>
AuthorDate: Wed Nov 25 14:28:55 2020 -0500

    DISPATCH-1856: avoid adding empty message buffer
---
 src/message.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/message.c b/src/message.c
index 2d05fd0..01a38e6 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1570,12 +1570,14 @@ qd_message_t *qd_message_receive(pn_delivery_t 
*delivery)
             // Return the message so that the caller can start sending out 
whatever we have received so far
             //
             // push what we do have for testing/processing
-            LOCK(content->lock);
-            qd_buffer_set_fanout(content->pending, content->fanout);
-            DEQ_INSERT_TAIL(content->buffers, content->pending);
-            content->pending = 0;
-            UNLOCK(content->lock);
-            content->pending = qd_buffer();
+            if (qd_buffer_size(content->pending) > 0) {
+                LOCK(content->lock);
+                qd_buffer_set_fanout(content->pending, content->fanout);
+                DEQ_INSERT_TAIL(content->buffers, content->pending);
+                content->pending = 0;
+                UNLOCK(content->lock);
+                content->pending = qd_buffer();
+            }
             break;
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to