Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
steve6354 opened this issue May 31, 2017 · 1 comment

Comments

@steve6354
Copy link

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.

@steve6354
Copy link
Author

Sorry, the xml code I tried to add directly to the original post did not copy properly. Here is a pdf of the xml 'message' definitions.

codec_error_xml.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant