You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2017/07/07 20:39:49 UTC

[12/14] qpid-dispatch git commit: DISPATCH-760: Prevent user anno's from being considered in routing logic

DISPATCH-760: Prevent user anno's from being considered in routing logic

Always provide four routing annotations by padding if necessary.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/425c898f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/425c898f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/425c898f

Branch: refs/heads/master
Commit: 425c898f623b973d30e98e1e971c70faff944da0
Parents: 40cb7c1
Author: Chuck Rolke <cr...@redhat.com>
Authored: Thu Jul 6 09:03:41 2017 -0400
Committer: Chuck Rolke <cr...@redhat.com>
Committed: Fri Jul 7 10:39:09 2017 -0400

----------------------------------------------------------------------
 src/message.c        | 5 +++++
 tests/message_test.c | 9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/425c898f/src/message.c
----------------------------------------------------------------------
diff --git a/src/message.c b/src/message.c
index c5b9b32..5fe77c2 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1196,6 +1196,11 @@ static void compose_message_annotations_v1(qd_message_pvt_t *msg, qd_buffer_list
                 qd_compose_insert_int(field, msg->ma_phase);
                 field_count++;
             }
+            // pad out to four fields
+            for  (; field_count < 4; field_count++) {
+                qd_compose_insert_symbol(field, QD_MA_PREFIX);
+                qd_compose_insert_string(field, "X");
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/425c898f/tests/message_test.c
----------------------------------------------------------------------
diff --git a/tests/message_test.c b/tests/message_test.c
index bc0156e..0bc8452 100644
--- a/tests/message_test.c
+++ b/tests/message_test.c
@@ -272,13 +272,16 @@ static char* test_send_message_annotations(void *context)
     pn_data_rewind(ma);
     pn_data_next(ma);
     if (pn_data_type(ma) != PN_MAP) return "Invalid message annotation type";
-    if (pn_data_get_map(ma) != 6) return "Invalid map length";
+    if (pn_data_get_map(ma) != 8) return "Invalid map length";
     pn_data_enter(ma);
-    for (int i = 0; i < 6; i+=2) {
+    for (int i = 0; i < 8; i+=2) {
         pn_data_next(ma);
         if (pn_data_type(ma) != PN_SYMBOL) return "Bad map index";
         pn_bytes_t sym = pn_data_get_symbol(ma);
-        if (!strncmp(QD_MA_INGRESS, sym.start, sym.size)) {
+        if (!strncmp(QD_MA_PREFIX, sym.start, sym.size)) {
+            pn_data_next(ma);
+            sym = pn_data_get_string(ma);
+        } else if (!strncmp(QD_MA_INGRESS, sym.start, sym.size)) {
             pn_data_next(ma);
             sym = pn_data_get_string(ma);
             if (strncmp("distress", sym.start, sym.size)) return "Bad ingress";


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