Skip to content

in generated xxx_send function codec puts code from one message into another. #364

Open
@steve6354

Description

@steve6354

When 2 different xml defined messages each contain a 'msg' field, the code for only one of them ends up in the send handling for both.
Here is a snip of the two definitions from the xml file.



A single CommandMessageData object
231B14A411



A sequence of 'protobuf' defined parameters
SomeParam4145851f

and here is a snip of the relevant section from the xxx_send function

switch (self->id) {
case CODEC_ERROR_COMMANDMESSAGEDATA:
PUT_NUMBER2 (self->sequence);
nbr_frames += self->command_message_data? zmsg_size (self->command_message_data): 1;
have_param_sequence = true;
break;

    case CODEC_ERROR_SETPARAMETER:
        PUT_NUMBER2 (self->sequence);
        nbr_frames += self->param_sequence? zmsg_size (self->param_sequence): 1;
        have_param_sequence = true;
        break;

}
//  Now send the data frame
zmq_msg_send (&frame, zsock_resolve (output), --nbr_frames? ZMQ_SNDMORE: 0);

//  Now send the param_sequence if necessary
if (have_param_sequence) {
    if (self->param_sequence) {
        zframe_t *frame = zmsg_first (self->param_sequence);
        while (frame) {
            zframe_send (&frame, output, ZFRAME_REUSE + (--nbr_frames? ZFRAME_MORE: 0));
            frame = zmsg_next (self->param_sequence);
        }
    }
    else
        zmq_send (zsock_resolve (output), NULL, 0, 0);
}

You can see in the switch statement the 'have_param_sequence' variable is set to true for both message IDs. Then there is only an 'if (have_param_sequence)' block which will only check for 'param_sequence'. So a COMMANDMESSAGEDATA message type will always send an empty frame.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions