You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2020/06/24 18:12:31 UTC

[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #751: Adaptor-plugin refactoring for multi-protocol data plane

kgiusti commented on a change in pull request #751:
URL: https://github.com/apache/qpid-dispatch/pull/751#discussion_r445080450



##########
File path: src/message.c
##########
@@ -2178,6 +2197,130 @@ void qd_message_compose_4(qd_message_t *msg, qd_composed_field_t *field1, qd_com
 }
 
 
+void qd_message_compose_5(qd_message_t        *msg,
+                          qd_composed_field_t *headers,
+                          qd_buffer_list_t    *body,
+                          bool                 complete)
+{
+    qd_message_content_t *content         = MSG_CONTENT(msg);
+    qd_buffer_list_t     *headers_buffers = headers ? qd_compose_buffers(headers) : 0;
+
+    DEQ_INIT(content->buffers);
+    if (headers_buffers)
+        DEQ_APPEND(content->buffers, (*headers_buffers));
+
+    if (body) {
+        DEQ_APPEND(content->buffers, (*body));
+    }
+
+    content->receive_complete = complete;
+}
+
+
+int 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);
+    int                   count;
+
+    LOCK(content->lock);
+    while (buf) {
+        qd_buffer_set_fanout(buf, content->fanout);
+        buf = DEQ_NEXT(buf);
+    }
+
+    DEQ_APPEND(content->buffers, (*buffers));
+    count = DEQ_SIZE(content->buffers);
+    UNLOCK(content->lock);
+    return count;
+}
+
+
+int qd_message_read_body(qd_message_t *in_msg, pn_raw_buffer_t* buffers, int length)

Review comment:
       Idea - why not get rid of qd_message_receive() and qd_message_send() APIs and instead use a generic buffer-append buffer-pop API?  qd_message_receive() and qd_message_send() are proton specific and maybe that logic belongs in the AMQP default adaptor?
   
   You've basically added that buffer-pop API for the message sender side, might as well go whole hog and take the pn_* stuff out of the message entirely.
   
   Of course I haven't really thought of the implications and have been drinking lots of coffee at the moment...




----------------------------------------------------------------
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:
users@infra.apache.org



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