-
Notifications
You must be signed in to change notification settings - Fork 24
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
The type of federate_id is used mixing uint16_t and int, and int32_t. #449
Comments
It does look like the clock sync code should be sending and receiving The use of an int32_t for recording the ID, I think, is so that -1 can be used to indicate an error or unknown. I don't see why this would create problems. Can you clarify? I don't understand the question about 16-bit systems. Even a 16-bit system should respect these data types. |
Oh, now I see why it's recording it as int32_t. The point I was concerned is on this part. // util.c
/**
* The ID of this federate. For a non-federated execution, this will be -1.
* For a federated execution, it will be assigned in the generated code.
*/
int _lf_my_fed_id = -1; It's just saving it as an |
Oh, possibly, yes. This would be better declared as an |
I made a PR on this issue. #453 |
The use of federate_id's type is being mixed.
MSG_TYPE_FED_IDS
. It is sending it as unit16_t.MSG_TYPE_CLOCK_SYNC_T3
with its federate_id as int32_t. However the buffer size is defined as1 +sizeof(int)
which can be critical for 16-bit systems.fed->enclave.id
, which is uint16_tSo, is this intended? Or is it just a bug. It seems it didn't really matter because we are not using federates more than 2^16. However, it seems that the part
int _lf_my_fed_id = -1;
that defines the federate_id asint
seems dangerous, when considering using 16-bit systems. Sending MSG_TYPE_CLOCK_SYNC_T3 on 16-bit systems will only send 1+2 bytes, and the RTI will attempt to read 1 + 4bytes, which will block on the read().The text was updated successfully, but these errors were encountered: