You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2020/08/04 18:58:05 UTC

[qpid-dispatch] 19/32: Dataplane: Set proper buffer refcount in messages during buffer-extend. This ensures that the streaming buffers are properly freed when no longer needed.

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

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

commit 777f0b7f0709143717291f6819dd20f795dab701
Author: Ted Ross <tr...@apache.org>
AuthorDate: Fri Jun 5 10:16:54 2020 -0400

    Dataplane: Set proper buffer refcount in messages during buffer-extend. This ensures that the streaming buffers are properly freed when no longer needed.
---
 src/message.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/message.c b/src/message.c
index 87c559e..8b833f3 100644
--- a/src/message.c
+++ b/src/message.c
@@ -2221,7 +2221,16 @@ void qd_message_compose_5(qd_message_t        *msg,
 void qd_message_extend(qd_message_t *msg, qd_buffer_list_t *buffers)
 {
     qd_message_content_t *content = MSG_CONTENT(msg);
+    qd_buffer_t          *buf     = DEQ_HEAD(*buffers);
+
+    LOCK(content->lock);
+    while (buf) {
+        qd_buffer_set_fanout(buf, content->fanout);
+        buf = DEQ_NEXT(buf);
+    }
+
     DEQ_APPEND(content->buffers, (*buffers));
+    UNLOCK(content->lock);
 }
 
 


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