diff options
| author | Ted Ross <tross@apache.org> | 2013-09-05 14:41:30 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2013-09-05 14:41:30 +0000 |
| commit | 2ecd5ff8ea6f119db64bde1e46ff3bf7fcc39d47 (patch) | |
| tree | 4133a04f0d3a17ca203e8731a3ce029729cc1215 /qpid | |
| parent | 6d83b6405aa6d47b0e24dfa3be04eb841841f013 (diff) | |
| download | qpid-python-2ecd5ff8ea6f119db64bde1e46ff3bf7fcc39d47.tar.gz | |
QPID-5068 - Fixed a bug in the replacement of delivery annotations.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1520334 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
| -rw-r--r-- | qpid/extras/dispatch/src/message.c | 29 | ||||
| -rw-r--r-- | qpid/extras/dispatch/src/message_private.h | 9 |
2 files changed, 24 insertions, 14 deletions
diff --git a/qpid/extras/dispatch/src/message.c b/qpid/extras/dispatch/src/message.c index fd2a50138c..d75651d9b7 100644 --- a/qpid/extras/dispatch/src/message.c +++ b/qpid/extras/dispatch/src/message.c @@ -96,7 +96,10 @@ static int traverse_field(unsigned char **cursor, dx_buffer_t **buffer, dx_field { unsigned char tag = next_octet(cursor, buffer); if (!(*cursor)) return 0; - int consume = 0; + + int consume = 0; + size_t hdr_length = 1; + switch (tag & 0xF0) { case 0x40 : consume = 0; break; case 0x50 : consume = 1; break; @@ -108,6 +111,7 @@ static int traverse_field(unsigned char **cursor, dx_buffer_t **buffer, dx_field case 0xB0 : case 0xD0 : case 0xF0 : + hdr_length += 3; consume |= ((int) next_octet(cursor, buffer)) << 24; if (!(*cursor)) return 0; consume |= ((int) next_octet(cursor, buffer)) << 16; @@ -119,16 +123,18 @@ static int traverse_field(unsigned char **cursor, dx_buffer_t **buffer, dx_field case 0xA0 : case 0xC0 : case 0xE0 : + hdr_length++; consume |= (int) next_octet(cursor, buffer); if (!(*cursor)) return 0; break; } if (field && !field->parsed) { - field->buffer = *buffer; - field->offset = *cursor - dx_buffer_base(*buffer); - field->length = consume; - field->parsed = 1; + field->buffer = *buffer; + field->offset = *cursor - dx_buffer_base(*buffer); + field->length = consume; + field->hdr_length = hdr_length; + field->parsed = 1; } advance(cursor, buffer, consume, 0, 0); @@ -238,10 +244,11 @@ static int dx_check_and_advance(dx_buffer_t **buffer, // // Pattern matched and tag is expected. Mark the beginning of the section. // - location->parsed = 1; - location->buffer = test_buffer; - location->offset = test_cursor - dx_buffer_base(test_buffer); - location->length = 0; + location->parsed = 1; + location->buffer = test_buffer; + location->offset = test_cursor - dx_buffer_base(test_buffer); + location->length = 0; + location->hdr_length = pattern_length; // // Advance the pointers to consume the whole section. @@ -613,7 +620,9 @@ void dx_message_send(dx_message_t *in_msg, dx_link_t *link) // Skip over replaced delivery annotations // if (content->section_delivery_annotation.length > 0) - advance(&cursor, &buf, content->section_delivery_annotation.length, 0, 0); + advance(&cursor, &buf, + content->section_delivery_annotation.hdr_length + content->section_delivery_annotation.length, + 0, 0); // // Send remaining partial buffer diff --git a/qpid/extras/dispatch/src/message_private.h b/qpid/extras/dispatch/src/message_private.h index 025c078d37..27b81bbb4c 100644 --- a/qpid/extras/dispatch/src/message_private.h +++ b/qpid/extras/dispatch/src/message_private.h @@ -45,10 +45,11 @@ */ typedef struct { - dx_buffer_t *buffer; // Buffer that contains the first octet of the field, null if the field is not present - size_t offset; // Offset in the buffer to the first octet - size_t length; // Length of the field or zero if unneeded - int parsed; // non-zero iff the buffer chain has been parsed to find this field + dx_buffer_t *buffer; // Buffer that contains the first octet of the field, null if the field is not present + size_t offset; // Offset in the buffer to the first octet + size_t length; // Length of the field or zero if unneeded + size_t hdr_length; // Length of the field's header (not included in the length of the field) + int parsed; // non-zero iff the buffer chain has been parsed to find this field } dx_field_location_t; |
